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 :
Microsoft Dynamics AX (Archived)

How to add a new discount method to Price Adjustment under Retail

(0) ShareShare
ReportReport
Posted on by 1,461

I have to add a new price adjustment discount method. Standard AX only allow for a discount percentage or discount amount under Retail -> Common -> Pricing and Discounts -> Price Adjustments to reduce the base price. Our sales reps want to mark up the base price.

I have added a new field called MarkupPercentageValue to the RetailPeriodicDiscount table. I have also added 2 fields, one for the amount and one for the percentage in the table RetailDiscountLineOffer.

The discountMethod gets its values from BASE ENUM  RetailDiscountOfferLineDiscMethodBase. The standard values are: PercentOff, AmountOff, Price ad PriceInclTax. I have added to it MarkupPercentage and MarkupAmount.

Now the setup is in place and the end-user can select a discountmethod to mark up the base price with either an amount or a percentage.

My problem is to add this calculation to the sales order price calculations. I have searched where the periodic discount tables were used and found them in classes RetailPricingDataManager and RetailPricingDataManagersimulator and in RetailCreateLinesFromProductsToAdd. I have modified these to include the 2 new fields on RetaildiscountLineOffer. However they are just populating containers.

It looks like the actual pricing calculations happens in a CRT engine. I came across a link that pointed me to Class RetailSalesOrderCalculator. However this class still only get and set values. Where can I find the calculations for the standard price adjustment discount method PercentOff and AmountOff so that I can add my logic to it?

*This post is locked for comments

I have the same question (0)
  • Retha Profile Picture
    1,461 on at

    What I can figure out this far is that the method RetailSalesOrderCalculator uses methods in RetailPricingDataManager class for the pricing adjustments: findPriceAdjustments, getPriceAdjustmentsForItems and then it builds a container with method: buildRetailDiscountContainer.

    I have added my 2 new fields everywhere discPct is referenced. I also modified RetailDiscountLineOffer.applydiscount()  to include the calculations needed for the new discount methods I added.

    ****

    if (discountOffer)

       {

           switch (this.DiscountMethod)

           {

               case RetailDiscountOfferLineDiscMethodBase::AmountOff:              return decRound(_price - this.DiscAmount,2);

               case RetailDiscountOfferLineDiscMethodBase::PercentOff:             return decRound(_price - (_price * this.DiscPct /100),2);

               // <Begin Custom - add the logic for the markup>

               case RetailDiscountOfferLineDiscMethodBase::TMC_MarkupAmount:       return decRound(_price + this.MarkupAmount,2);

               case RetailDiscountOfferLineDiscMethodBase::TMC_MarkupPercentage:   return decRound(_price + (_price * this.MarkupPerc /100),2);

               // </End custom>

               case RetailDiscountOfferLineDiscMethodBase::Price:                  return decRound(this.OfferPrice,2);

               case RetailDiscountOfferLineDiscMethodBase::PriceInclTax:           return decRound(this.OfferPriceInclTax,2);

           }

       }

    ****

    I did do an incremental CIL compile.

    I stepped through the code and the PriceAdjustment container does pick up the new discountMethod with its value.

    Now here is where I am stuck.  

    It makes use of the RetailPricingEngineHelper. This seems to use a DLL: Microsoft.Dynamics.Commerce.Runtime.Services.PricingEngine.dll

    How can I view the code that makes up this DLL to see if I need to change something in here?

    I REALLY REALLY would prefer not to touch the DLL. Has anybody ever had to modify price adjustments and can tell me what I need to change for it to pick up RetailDiscountLineOffer.applydiscount() method?

  • Vishal Dynamics Profile Picture
    255 on at

    Hi R-AX,

    I have similar kind of requirement in D365 FinOps. Can you please advise if you were able to solution this problem.

    Thanks,

    Vishal Kohli

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
imran ul haq Profile Picture

imran ul haq 8

#3
André Arnaud de Calavon Profile Picture

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

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans