Define rollup fields
In Microsoft Dynamics CRM, rollup fields are designed to help users obtain insights into data by monitoring key business metrics. A rollup field contains an aggregate value computed over the records related to a specified record, such as open opportunities of an account, or over the hierarchy of records in more complex scenarios. As an administrator or customizer, you can use the CRM user interface to define rollup fields.
Rollup fields benefits and capabilities
- The benefits and capabilities of rollup fields include the following:
- Visual editing is easy. You can create rollup fields by using the Field Editor, just like you do when you create a regular field.
- Wide selection of aggregate functions. You can aggregate data by using functions, such, as SUM, COUNT, MIN, or MAX.
- Full filter support for aggregation. You can set various filters for the source entity or related entity while setting multiple conditions.
- Seamless integration with the user interface. You can include the rollup fields in forms, views, charts and reports.
- Rollup fields are solution components. You can easily transport the rollup fields as components between organizations and distribute them in solutions.
- Rollup fields and the calculated fields are complementary to each other. You can use a rollup field as a part of the calculated field, and vice versa.
- Some examples of rollup fields include:
- Total estimated revenue of open opportunities of an account
- Total estimated revenue of open opportunities across all accounts in a hierarchy
- Total estimated revenue of an opportunity including child opportunities
- Total estimated value of qualified leads generated by a campaign
- Number of high priority open cases across all accounts in a hierarchy
- Earliest created time of all high priority open cases for an account
Each Rollup field creates two accessory fields with <fieldname>_date and <fieldname>_state suffix pattern. The _date field is of the Datetime data type and _state field is of the integer data type. The _state field has the following values:
- 0 => NotCalculated. The field value is yet to be calculated.
- 1 => Calculated. The field value has been calculated per the last update time in _date field
- 2 => OverflowError. The field value calculation resulted in overflow error.
- 3 => OtherError. The field value calculation failed due to an internal error. The following run of the calculation job will likely fix it.
- 4 => RetryLimitExceeded. The field value calculation failed because the maximum number of retry attempts to calculate the value was exceeded due to high number of concurrency and locking conflicts.
- 5 => HierarchicalRecursionLimitReached. The field value calculation failed because the maximum hierarchy depth limit for the calculation was reached.
- 6 => LoopDetected. The field value calculation failed because a recursive loop was detected in the hierarchy of the record.
The rollups are calculated by scheduled system jobs that run asynchronously in the background. You have to be an administrator to view and manage the rollup jobs. To view the rollup jobs go to Settings > System Jobs > View > Recurring System Jobs. To quickly find a relevant job, you can filter by the System Job type: Mass Calculate Rollup Field or Calculate Rollup Field.
- Mass Calculate Rollup Field is a recurring job, created per a rollup field. It runs once, after you created or updated a rollup field. The job recalculates the specified rollup field value in all existing records that contain this field. By default, the job will run 12 hours after you created or updated a field. After the job completes, it is automatically scheduled to run in the distant future, approximately, in 10 years. If the field is modified, the job resets to run again in 12 hours after the the update. The 12 hour delay is needed to assure that the Mass Calculate Rollup Field runs during the non-operational hours of the organization. It is recommended that an administrator adjusts the start time of a Mass Calculate Rollup Field job after the rollup field is created or modified, in such a way that it runs during non-operational hours. For example, midnight would be a good time to run the job to assure efficient processing of the rollup fields.
- Calculate Rollup Field is a recurring job that does incremental calculations of all rollup fields in the existing records for a specified entity. There is only one Calculate Rollup Field job per entity. The incremental calculations mean that the Calculate Rollup Field job processes the records that were created, updated or deleted after the last Mass Calculate Rollup Field job finished execution. The default maximum recurrence setting is one hour. The job is automatically created when the first rollup field on an entity is created and deleted when the last rollup field is deleted.
- Online recalculation option. If you hover over the rollup field on the form, you can see the time of the last rollup and you can refresh the rollup value by clicking the Refresh icon next to the field.
There are a few considerations you should keep in mind when using the online recalculation option (manual refresh on the form):
- You have to have Write privileges on the entity and Write access rights on the source record on which you are requesting the Refresh. For example, if you are calculating the estimated revenue from the open opportunities of an account, you don’t have to have Write privileges on the opportunity entity, only on the account entity.
- This option is only available in the online mode. You can’t use it while working offline.
- The maximum number of records during the rollup refresh is limited to 50,000 records. In case of the hierarchical rollup, this applies to the related records across the hierarchy. 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.
As a system administrator, you can modify the rollup job recurrence pattern, postpone, pause or resume the rollup job. However, you can’t cancel or delete a rollup job. To pause, postpone, resume or modify the recurrence pattern, go to Settings > System Jobs. In View, select Recurring System Jobs. On the nav bar, click or tap Actions and select the action you want. For the Mass Calculate Rollup Field job, the available selections are: Resume, Postpone, and Pause. For the Calculate Rollup Field job, the available selections are: Modify Recurrence, Resume, Postpone, and Pause.
Disclaimer: this text is part of the “Administering CRM 2015 for online and on-premises”-Guide, I have not written this myself and do not claim any ownership of it. Moreover this document is provided “as-is”.