web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
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();
    }
 
I have the same question (0)
  • Martin Dráb Profile Picture
    239,387 Most Valuable Professional on at
    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.
  • Waed Ayyad Profile Picture
    9,133 Super User 2026 Season 1 on at
    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
  • M_R Profile Picture
    123 on at
    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);
            
        }
    }
  • Martin Dráb Profile Picture
    239,387 Most Valuable Professional on at
    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.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 689

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 606 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 356

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans