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 CRM (Archived)

Update Order Product extendedamount Using CRM Plugin

(0) ShareShare
ReportReport
Posted on by 902

Hello,

I have done this code for updating order product. Value is not updated and also not getting any error.

// Instaniate an salesorderdetail object.
               Entity orderProduct = new Entity("salesorderdetail");

               // Create a column set to define which attributes should be retrieved.
               ColumnSet salesOrderDetailAttributes = new ColumnSet(new string[] { "baseamount" });

               // Retrieve the salesorderdetail and its name and ownerid attributes.
               orderProduct = service.Retrieve(orderProduct.LogicalName, Id, salesOrderDetailAttributes);

               //get value of base price of order product
               decimal tempPrice = ((Money)orderProduct["baseamount"]).Value;

               if (typePrice !=0)
                   tempPrice = typePrice + tempPrice;//add type price value

               if (mountingStylePrice != 0)
                   tempPrice = mountingStylePrice + tempPrice; //add mountingStyle Price value

               if (substratePrice != 0)
                   tempPrice = substratePrice + tempPrice;//add substrate Price value

               orderProduct["extendedamount"] = new Money(tempPrice);

               service.Update(orderProduct);

Plugin run sucessfully but extendedamount not updated.

Thanks,

keyur shah

*This post is locked for comments

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Field you trying to update with your code is Automatically calculated so you can't updated it via SDK call. To update it you will have to update one of fields it's formed from.

    Good luck.

  • Suggested answer
    keyur7379 Profile Picture
    902 on at

    Thanks Andrew.

    But Microsoft suggested code to update extendedamount. Please refer below mentioned which is suggested by microsoft.

    URL : https://msdn.microsoft.com/en-us/library/dn817877.aspx

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Do you have that setting mentioned in article enabled for your system?

  • Verified answer
    Community Member Profile Picture
    on at

    In recent times I had to deal with custom calculations frequently.

    In my experience, it's best not to use custom calculations, but to work by modifying the values involved in this calculation (for example, modifying the price per unit or discount or other values, without touch the calculated values).

    The reason for this choice is that using the custom calculation you need to rebuild the entire system of product selection, pricing, and calculation, etc. and it's really time consuming.

    Hope it helps.

    Greetings

    Francesco Picchi

  • Suggested answer
    keyur7379 Profile Picture
    902 on at

    Thanks Francesco Picchi.

    As you mentioned I have create one custom field and did price calculation in this field so system calculation work by default.

    First I have created plugin for price calculation but it gives me error. So I have used custom workflow and It works fine for me.

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans