Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

display AvailPhysical to salesline as per the itemid and the dimensions in salestable form

(0) ShareShare
ReportReport
Posted on by 123
Hello,
 
i am going to add AvailPhysical to salesline as per the itemid and the dimensions in salestable form.
what could be used table extensioin or event handler of salesline table
pls suggest, i have tried with this code but not coming
 
display InventQtyAvailPhysical inventQtyAvailPhysical()
    {
        InventOnHand     inventOnHand = InventOnHand::construct();
        InventDimParm    inventDimParm;
        ;
 
        inventDimParm.initFromInventDim(
                 InventDim::findOrCreateBlank());
        inventOnHand.parmInventDimParm(inventDimParm);
 
        inventOnHand.parmItemId(this.ItemId);
        return inventOnHand.availPhysical();
    }
 
  • Martin Dráb Profile Picture
    Martin Dráb 230,842 Most Valuable Professional on at
    display AvailPhysical to salesline as per the itemid and the dimensions in salestable form
    Dear M_R, please learn how to compile your, instead of throwing to a forum. The compiler will show you all the places where you're trying to use field that don't exist. You won't need to put code to a forum and wait for reply; you'll immediately have the answer from the compiler.
     
    When you fix all the compilation error, run your code and check whether it behaves as expected. The debugger will help you to learn details.
     
    I suggest you throw this new code away and return to the previous one, because you made things much worse.
     
    You'll also need to learn a bit about inventory dimensions, because you clearly lack this knowledge. The key table is InventDim. It contains combinations of inventory dimensions (such as color, site, pallet etc.) and assigns an ID to each unique combinations. Tables using inventory dimensions don't duplicate field for inventory dimensions; instead, they refer to the ID. Therefore SalesLine table stores information about inventory dimensions in SalesLine.InventDimId field (which is a reference to InventDim table).
     
    In your original code, you used empty dimensions (InventDim::findOrCreateBlank()), while you should utilize this.InventDimId field.
  • M_R Profile Picture
    M_R 123 on at
    display AvailPhysical to salesline as per the itemid and the dimensions in salestable form
    display method to salesline through inventsum
     
    [ExtensionOf(tablestr(SalesLine))]
    final class SalesLine_Extension
    {
        display public real AvailPhysical()
        {
            //SalesLine salesLine;
            InventSum inventSum;
            //InventDim inventDim;
            SalesTable salesTable;
            
            salesTable=SalesTable::find(this.SalesId);
            
            select   inventsum where inventsum.ItemId == this.ItemId
                && inventsum.InventSiteId == salesTable.InventSiteId && inventSum.InventLocationId == salesTable.InventLocationId;
                 
            return(inventSum.AvailPhysical);
            
        }
    }
  • Waed Ayyad Profile Picture
    Waed Ayyad 7,085 Super User 2025 Season 1 on at
    display AvailPhysical to salesline as per the itemid and the dimensions in salestable form
    Hi MR,
     
    Can you give us more details like where you use the above Display method? Also did you try to debug the code?
     
     
    Thanks,
    Waed Ayyad
  • Martin Dráb Profile Picture
    Martin Dráb 230,842 Most Valuable Professional on at
    display AvailPhysical to salesline as per the itemid and the dimensions in salestable form
    Please tell us more about your problem than just "not coming". What did you find when you debugged your code?
     
    One obvious problem is that you wanted to use inventory dimensions from the sales line, but you don't have that in your code.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans