Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Stop Overwrite Prices and Discounts using code

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

I created a Sales Order through code. In the Sales Line I am setting a Unit Price which is different to Trade Agreement Price. It creates the sales order with the new assigned price.

But the problem is when I perform any operation on Sales Order it updates the unit price with the default Product price.

I know it has something to do with Trade Agreement Evaluation. Sales Line has a field ManualEntryChangePolicy but i don't know how to set this. Can someone tell me how to implement this manual change in code? 

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Stop Overwrite Prices and Discounts using code

    Thank you Sohaib for reply.

    I read White paper on Trade Agreement Evaluation and got a bit of idea about this. Here is the link.

    And I resolved my issue by calling method
    Salesline.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry, fieldNum(Salesline, SalesPrice));

    and it set the ManualEntryChangePolicy and I guess it breaks the link of sales price with Trade agreement.

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Stop Overwrite Prices and Discounts using code

    These kind of issues are difficult to guess and it takes more to debug usually. For your issue, only hint I can provide you a Map named as SalesPurchLine.

    If you will search SalesPurchLine on following two objects you would find many times, the use of the Map (SalesPurchLine)

    1) \Data Dictionary\Tables\SalesLine

    2) \Classes\SalesLineType

    Basically the map named SalesPurchLine, contains lot of methods that effect pricing of your sales line.

    Sales Line price is such a sensitive subject that it can get change by many factors in AX/D365. I would certainly recommend debugging.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans