Asynchronous Jobs        ||          Modify Recurrence Frequency                 ||               Limitations

Rollup fields were introduced with Microsoft Dynamics CRM 2015. A Rollup field contains aggregated value calculated from child records for a parent record. For example: Active Products for a Company or Open Opportunities for an Account.

To understand how Rollup calculation works and how frequent this calculation happens, we need to understand what happens when you create a Rollup field for an entity.

Asynchronous System Jobs:

Dynamics 365 creates two asynchronous recurring system jobs as below when new Rollup field in created for an entity:

  • Mass Calculate Rollup Field – This job is created per Rollup field and runs when you create or update Rollup field. By default, job runs in 12 hours after you create or update Rollup field. You can adjust start time of this job to make sure job runs during non-operational hours
  • Calculate Rollup Field – One job per entity and gets created when first Rollup field is created for an entity and deleted when last Rollup field is deleted. This job is responsible for incremental calculation for all Rollup fields in an entity after Mass Calculate Rollup Field job finishes execution. By default, this job is schedule to run every hour which is maximum recurrence setting

You can monitor these two jobs under Systems jobs entity using “Recurring System Jobs” view as:

  • Go to Settings -> System Jobs. Select Recurring System Jobs view from dropdown
  • Apply filter on System Job Name contains “entity name”

R1

Modify Recurrence Frequency:

As mentioned above, Mass Calculate Rollup Field job is executed in 12 hours after Rollup field is created or updated. But in case you do not want to wait for 12 hours and have first instance of job to be started immediately, follow below steps:

  • Out of 2 jobs shown in above snapshot, double click on “Mass Calculate Rollup Field” Job
  • Select Actions menu in top navigation and Click on “Resume option”. This option will initiate the job right away instead of waiting for 12 hours.

R2

Once Mass Calculate Rollup Field job is executed successfully, Calculate Rollup Field job will kick in and run every hour for any incremental changes on existing records. This setting is configurable in case you want this job to run less frequently, follow below steps:

  • Out of 2 jobs in first snapshot, double click on “Calculate Rollup Field” Job
  • Select Actions menu in top navigation and Click on “Modify Recurrence” option which will open a dialog

R3

  • You can select options to run job once in a day instead of every hour or update number of hours

R4

In case you want to calculate Rollup field immediately whenever child record gets created, updated or deleted, you can write custom C# plugin or custom workflow activity and use SDK message “CalculateRollupFieldRequest”. For more information refer blog.

Permissions:

  • You should have write access on parent entity where rollup field is created. You do not need to have write access on child entity. For ex: In case of Open Opportunities for an Account rollup field, you need write permissions on account entity only.

Limitations:

  • You can have 100 rollup fields per organization and 10 per entity at max
  • You can trigger workflow on change of rollup field value
  • Rollup field cannot refer another rollup field or calculated field
  • Rollup fields are not supported in offline mode while working with mobile/tablet
  • The maximum number of records during the rollup refresh is limited to 50,000 records. If the limit is exceeded, you see an error message: “Calculations can’t be performed online because the calculation limit of 50,000 related records has been reached.”. This limit does not apply when the rollup is automatically recalculated by the system jobs
  • The maximum hierarchy depth is limited to 10 for the source record. If the limit is exceeded, you see an error message: “Calculations can’t be performed online because the hierarchy depth limit of 10 for the source record has been reached.”. This limit does not apply when the Rollup is automatically recalculated by the system jobs

References:

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/customize/define-rollup-fields