Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Override Sales Order Trade Agreement Line Discount With Highest Discount %

(1) ShareShare
ReportReport
Posted on by 41
Hi,
 
I have the following scenario.
 
The client has Line Discount Trade Agreements configured for customers.
 
For a single customer there could be multiple Line Discount TA's configured for the same item and well as inventory dimensions, the only difference being the applicable date and the discount %.
 
Some customers also have a combination of All, Group and Table codes with various discount % and they could all be "active" at the same time
 
For the most part the discounts are created with "Find Next" = false.
 
Standard FO will use the All > Group > Table hierarchy to find an applicable discount and will mostly settle on the lowest discount value depending on this hierarchy and whether or not "Find Next" is true or false as well as the price attribute combination rank.
 
My requirement is to override this logic at sales line creation and find the single highest applicable discount % regardless if this value falls under All, Group or Table.
 
I have had a look at the logic in SalesLine.SetPriceDisc and the subsequent call stack but I am unsure where exactly to add logic to override this safely...
 
If anyone has had this requirement or could offer some guidance it would be greatly appreciated.
 
Thank you in advance.
Categories:
  • Justin Kruger Profile Picture
    Justin Kruger 41 on at
    Override Sales Order Trade Agreement Line Discount Price With Highest Price
    Hi Andre,
     
    Thank you for your reply.
     
    My apologies for the confusion, please allow me to clarify the requirements with the below examples.
     
    Please consider the below line discount examples posted for a customer.
     
    Example 1:
     
    There are 3 active discounts for a combination of Table and Group product code types.
     
    Item ALSBABYH belongs to line discount group 0019 and Find Next is True on all lines.
     
     
    Due to Find Next being True on all lines the resultant sales order line compounds the discount percentage, resulting in a discount of 50%

     
     
    Example 2:
     
    There are 3 active discounts for a combination of Table and Group product code types.
     
    Item ALSBABYH belongs to line discount group 0019 and Find Next is False on all lines.
     
     
     
    Due to Find Next being False on all lines the price engine finds the first applicable discount and stops, the result being the lowest discount of 10% is awarded.

     
    In both of these examples the expectation is that the single highest discount should be applied that being 25%, regardless of the All > Group > Table hierarchy and of the state of the Find Next flag.
     
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,559 Super User 2024 Season 2 on at
    Override Sales Order Trade Agreement Line Discount Price With Highest Price
    Hi Justin,
     
    I'm not fully sure if you are looking for having the most expensive price option for a customer or the lowest price/highest discount. The title and text is a bit confusing to me.
     
    The pricing engine searches with a priority on Table, Group, and All. In case Find next is set to false, it stops searching for other prices. In case this field is set to yes, it will continue searching and it will select the lowest price option. 
  • Justin Kruger Profile Picture
    Justin Kruger 41 on at
    Override Sales Order Trade Agreement Line Discount Price With Highest Price
    Hi Sagar,
     
    Thank you for your reply.
     
    I did look at those parameters yes and I did a test with your suggested parameter of MAX(Line,Multiline). In my scenario no multiline discounts exist and the line discount calculation stayed the same. It did not apply the highest line discount. I believe that parameter just selects the MAX between Line and Multiline, if both discount types exist, it does not necessarily select the highest from only line discounts
  • Suggested answer
    sagar_patil Profile Picture
    sagar_patil 533 on at
    Override Sales Order Trade Agreement Line Discount Price With Highest Price
    Hi,
     
    Did you check this?
     
     
    Here select MAX(Line,Multiline)
    The system considers both the calculated line discount and the multiline discount and applies only the better of the discounts.
     
     
    Note: Please help verify answer(s) if they guide you in right direction so other community members can also benefit from your question with verified answer.
     

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,579 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans