Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CalculatePrice Plugin

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have created a plugin which replaces the CalcualtePrice Out-of-the-box pricing engine.

It functions wonderfully, I have set it to retrieve the price list from the parent record and then check against discounts for the quantity.

However there is one last thing which the plugin cant seem to do - update the Line item's volumediscountamount field.

this is a snippet of the code:

lineItemUpdate["volumediscountamount"] = new Money(volumeDiscount);
lineItemUpdate["new_discountedpriceperunit"] = new Money(discountedPPU);
lineItemUpdate["baseamount"] = new Money(baseAmount);
lineItemUpdate["extendedamount"] = new Money(extendedAmount);
service.Update(lineItemUpdate);

All other fields update properly, however the volumediscountamount field stays at zero.

I have checked audit and the field is not being set by the plugin.

*This post is locked for comments

  • Suggested answer
    antc Profile Picture
    antc 2,909 on at
    RE: CalculatePrice Plugin

    invoicedetail EntityType

    volumediscountamount

    Edm.Decimal

    Description: Shows the discount amount per unit if a specified volume is purchased. Configure volume discounts in the Product Catalog in the Settings area.

    Display Name: Volume Discount

    Read-only property

    volumediscountamount_base

    Edm.Decimal

    Description: Shows the Volume Discount field converted to the system's default base currency for reporting purposes. The calculation uses the exchange rate specified in the Currencies area.

    Display Name: Volume Discount (Base)

    Read-only property

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CalculatePrice Plugin

    I cannot see where the SDK does suggest read only for this field. therefore I cannot mark this as an answer - only a best guess.

    Edit: After looking thoroughly through the SDK, there are multiple references as to where the field can (and should) be used to apply the volume discount. however you are correct that it states it is read only property.

    I think the only way around this "feature" is to create a custom field. 

  • antc Profile Picture
    antc 2,909 on at
    RE: CalculatePrice Plugin

    Dynamics 365 SDK

    [View:https://www.microsoft.com/en-us/download/details.aspx?id=50032]

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CalculatePrice Plugin

    Thanks Antc.

    Could you please link me to the SDK regarding this field? I am going to create another field to populate this data into as you suggested.

  • antc Profile Picture
    antc 2,909 on at
    RE: CalculatePrice Plugin

    I think that you would have to try to work around it in the plugin code and update one of the other fields to mimic a volume discount as the SDK suggests read only.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CalculatePrice Plugin

    Thanks antc.

    Any ideas how to overcome this limitation of the read-only setting within this context?

    e.g. what should I do to set this field?

  • antc Profile Picture
    antc 2,909 on at
    RE: CalculatePrice Plugin

    I think that it's read only in this context where as I think discountamount is updateable.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans