Sunday 30 August 2020

Programmatically Recalculating Rollup fields using C# in Dynamics 365/CRM

Hi Everyone,

Today I got an requirement to send some data to external system and they were looking for real time data. When I did the fields found some Rollup fields and we all know that Rollup fields are asynchronous in nature and it is managed by Recurring System Jobs.

I was kind of stuck, did a little search and understood that there is a SDK message which we can use for recalculating. Here is the code for the same.


CalculateRollupFieldRequest rollupRequest = new CalculateRollupFieldRequest
            {
                Target = new EntityReference("account", new Guid("475b158c-541c-e511-80d3-3863bb347ba8")),
                FieldName = "new_rollupfromchild"
            };


CalculateRollupFieldResponse response = CalculateRollupFieldResponse)crmService.Execute(rollupRequest);

Hope this helps.

--
Happy 365'ing
Gopinath.

2 comments:

  1. As a user of Microsoft Gold Partners, I must say it's an incredible platform that has transformed the way we manage our business processes. The seamless integration of CRM and ERP functionalities makes it a powerful tool for enhancing productivity and efficiency.

    ReplyDelete
  2. crmservice.execute..which reference needs?

    ReplyDelete