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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

How to the price of an item?

(0) ShareShare
ReportReport
Posted on by 1,552

So if i want to pass an itemId and get it's price, i noticed priceDiscTable can have different records for the same item. Which one should i take?

and if an item has a specific price why can i change the price when i create a sales order? and i think i can change the unit as well when creating the order while the item has a specific unit in priceDiscTable.

I have the same question (0)
  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: How to the price of an item?

    hi juniorAX,

    Have you looked at the SalesLine\initFromInventTable method? That should take care of setting the price for you.

  • junior AX Profile Picture
    1,552 on at
    RE: How to the price of an item?

    Hi  Gunjan,

    i want to pass an item then get it's price and other details. I don't think this method does that.

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: How to the price of an item?

    Hi junior AX,

    You have to pass the inventTable buffer into this method. You can get that passing the using the item like this - 

    InventTable inventTable = InevntTable:find(itemId);
    
    salesLine.initFromInventTable(inventTable);

  • junior AX Profile Picture
    1,552 on at
    RE: How to the price of an item?

    Hi Gunjan,

    I'm getting that the salesPrice is 0. is InventTable the correct place to get item prices?

    what is priceDiscTable used for?

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: How to the price of an item?

    Hi juniorAX,

    While entering the item into a sales order in the UI, are you getting a sales price? PriceDisc is used for getting prices from Trade agreements set up for the item for a particular customer.

  • junior AX Profile Picture
    1,552 on at
    RE: How to the price of an item?

    Hi Gunjan,

    when creating sales order, the unit price is always null.

    I think this is my case, the item price is different for each customer. How should i use the priceDiscTable to get the price?

  • Community Member Profile Picture
    on at
    RE: How to the price of an item?

    Hi junior AX

    The process of getting an item sales or purchase price from trade agreement is not a straight forward process.

    The system checks the dimensions, unit and other factors also to get an active price for an item.

    Please go though this link. Understand how a trade agreement works.

    Once you understand trade agreement then only you can able to understand how code is working on backend and what exactly system is doing through initFromInventTable.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    299,065 Super User 2025 Season 2 on at
    RE: How to the price of an item?

    Hi Junior AX,

    The price mechanism is handled in the application within the PriceDisc class. You can use the Find references option or meta data search to see where it is used to learn how to use this class to get the correct prices and discounts.

  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at
    RE: How to the price of an item?

    Hello junior AX,

    There has been quite some feedback/discussion here but things do not seem to be very clear.

    Can you please elaborate and provide more details on what price you are looking for? (cost, sales, trade agreement price, etc.)

    What's the aim of all this? Do you want to create a report, a new form or simply pass those values on?

    Would be great if you could take the time and describe things in more detail.

    Many thanks,

    Ludwig

  • junior AX Profile Picture
    1,552 on at
    RE: How to the price of an item?

    Hi AKHILESH, Andre and Ludwig,

    First thanks AKHILESH for the article it was very useful in helping me understanding the functionality.

    So it seems, whatever the setup is whether it was standard setup or for a specific customer of for specific price group (trade agreement) or sales agreement maybe not sure. This method initFromInventTable retrieves the last correct price based on priorities of the setup? correct?

    What i want

    i want to create a class(service) where i can pass: (any itemId with custAccount) and get the correct salesPrice and NetAmount. So i guess this means i want to get the price of a trade agreement. But i'm now thinking that maybe this specific custAccount doesn't have a special price so then maybe i should get the generic price as well. Is there a function that can help?

    Based on the method initFromInventTable i don't know how can i pass the custAccount.

    And for the priceDisc class I think it's a little bit complex, can someone guide me?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,188

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 868 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 593 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans