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)

recalculate Rollup Fields automatically

(0) ShareShare
ReportReport
Posted on by 215

i want to use this link:
santoshmscrm.wordpress.com/.../force-recalculate-rollup-fields-in-ms-crm-2015-programatically

how i must use it by create "post-entity-update" plugin ?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    If you have Visual Studio, you can download the XrmToolkit to simplify the creation process of Plugins, you can use XrmToolkit.

    You ca download Xrm Toolkit from here:

    https://xrmtoolkit.com/

    It has documentation on how to create Plugins, and other parts of CRM. Link below is on creating a plugin

    xrmtoolkit.com/.../PluginWizard

    If you don't have Visual Studio you can download the community edition of Visual Studio for free.

    The article that you linked above should give you enough in order to get a plugin up and running.

    Good luck.

  • ehsan af Profile Picture
    215 on at

    All is ok.

    but when i create plugin which message should I choose? ( assign, create, retrieve, revoke access, update,  ... ) .

    My guess is the "update" for this project

    and which message should I choose for pipeline stage? ( pre-validation, pre-operation or post-operation )

    My guess is the "post-operation" for this project

    and execution mode asynchronous or synchronous ?

    My guess is the "synchronous" for this project.

    Please confirm me for "recalculate Rollup Fields automatically" plugin

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    It would have to be on the Create, Update (by attribute) and Delete of the child entity (the entity which you are going to sum up the values on). Basically the recalculation will have to happen every time there is a change to the totals, so new record, update of amount in existing record, or deletion of record (if you allow it).

    Remember that calculations automatically happen every 12 hours.

  • ehsan af Profile Picture
    215 on at

    ok

    but I want to recalculate Rollup Fields automatically happen when any change occurs in the sub-entity (activities related to my entity).

  • Verified answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    If you want to recalculate the fields, you need an event to be triggered that would call the code to recalculate.

    That event has to be one of the triggers that I mentioned above.

    You can't have this run automatically unfortunately. That is by design. It will run after 12 hours.

    To make it run, you would have to add code that would call the CalculateRollupFieldRequest/Response classes.

    As I mentioned above, you would need to add the code to recalculate on the Create, Update and Delete Steps of the entity.

    If this is for activities, you would have to add the steps to your activities, and verify that the regardingobjectid type is your entity.

  • ehsan af Profile Picture
    215 on at

    I'm really confused I tried it but it does not work.

  • Verified answer
    prt33k Profile Picture
    6,907 on at

    CRM product calculate rollup using a job in every 12 hr. It doesnt happen synchronously.

    If you want the value to get rolled-up synchronously then you need to write plugin code. The code need to trigger when the child entity gets  created/updated(Post CREATE/Update).

    So if the amount field on account get rolled-up values from all the opportunities then you need to write a Post-Update plugin on opportunity which will calculate the rollup value as shown in the link you shared.

    but when i create plugin which message should I choose? ( assign, create, retrieve, revoke access, update,  ... ) .

    CREATE and UPDATE

    and which message should I choose for pipeline stage? ( pre-validation, pre-operation or post-operation )

    POST

    and execution mode asynchronous or synchronous ?

    SYNCHRONOUS

    You can use solution here and this will save you from coding: github.com/.../Dynamics-365-Workflow-Tools

  • ehsan af Profile Picture
    215 on at

    Sync workflow failed with error message - Unhandled Exception: Microsoft.Crm.Workflow.Services.InvalidCustomActivityExecutionException: 'new_rfc' entity doesn't contain attribute with Name = '1'.

      at System.Activities.WorkflowApplication.Invoke(Activity activity, IDictionary`2 inputs, WorkflowInstanceExtensionManager extensions, TimeSpan timeout)

      at System.Activities.WorkflowInvoker.Invoke(Activity workflow, IDictionary`2 inputs, TimeSpan timeout, WorkflowInstanceExtensionManager extensions)

      at Microsoft.Crm.Workflow.SynchronousRuntime.SynchronousWorkflowActivityHost.ExecuteWorkflowUsingInvoker(Activity workflow, ICommonWorkflowContext context)

      at Microsoft.Crm.Workflow.SynchronousRuntime.SynchronousWorkflowActivityHost.StartWorkflow(WorkflowActivationData activationData, ICommonWorkflowContext context)

    , error code - -2147220891

  • prt33k Profile Picture
    6,907 on at

    Hi Ehsan,

    The code is having issue - please post your code here.

    Thanks

    Prateek

  • ehsan af Profile Picture
    215 on at

    I used the solution that you inserted the link : (https://github.com/demianrasko/Dynamics-365-Workflow-Tools)

    i put one workflow on activity that use "Force Calculate Rollup Field" on "workflow-tools" solution, when activity update or create.

    and insert "FieldName" and "Parent RecordURL" link to related my entity that contains rollup field.

    my rollup field is on my entity that, caculate on activities related to my entity.

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