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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Would like to prevent SO line discount for specific items

(0) ShareShare
ReportReport
Posted on by 427

We have a sales order line discount challenge that I belive can not be met by data setup (too many variables).  We would like to prevent the SO form from defaulting in a line discount value at the time of adding a line to the SO.  This could be either from the header line discount field or any other trade agreement.  I think we need to handle this by code.  We plan on using a custom parameter at the item level to define if this item is allowing to be sold with a line discount or not.  Question is: where in Ax X++ should we intercept the line discount init / defaulting process to add the new criteria.  I looked at the table method named SalesLine.canEditDisc() method and map method named SalesPurchLine.setPriceAgreement(), but can't quite seem to make a decision on where to place the IF statement.

Thanks,

Patrick

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Patrick, take a look at the source code of PriceDisc class. This class and method discPercent() is actually called from SalesLine table (and SalesPurchLine map) to calculate percentages for various types of discounts.

    Depending on the requirements, there are different places where price calculations can be customized in the X++ code. In your case it might be the easiest to modify PriceDisc.lineDiscPct() method –  e.g. you can put those ifs there and return 0 when you want to prevent default discount being applied, or otherwise return calculated lineDiscPct.

  • Suggested answer
    Patrick van Oppen Profile Picture
    427 on at

    Jovan,

    Thanks for the input on the PriceDisc.LineDiscPct() method.  We have completed our customization at the CRM and SO levels and it works like charm.

    Patrick

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans