Business Rules Vs Rollup Fields Vs Calculated Fields

Microsoft Dynamics CRM 2013 introduced Business Rules, CRM 2015 introduced Rollups and Calculated Fields and CRM 2016 added further improvements. I wrote this post to help a CRM Community member on the forum requesting a comparison table for Business Rules, Rollup and Calculated field features. It can be common dilemma when trying to decide when is the most suitable time to use each of these customisation features so I hope the following table will help easily clarify the best scenarios for usage.

 

 

Feature Trigger Execution Client / Server Scope Conditions Fields Functions Limits Usage
Business Rules

 

On Load

On Change

Synchrounous / Real Time

Execution order:

First: System JavaScripts

Then: Custom Javascript  

Finally: Business Rules

Client: Specific Forms/ All Forms/

Server

Entity / All Forms / Specific Forms And / OR, not a mixure All Fields on the form body
  • Show Error Message
  • Set Field
  • Set Business Required
  • Set Visibility
  • Set Default Value
  • Lock / Unlock Field
Fields updated through Business Rules do not trigger the fields on change event of JavaScript. Reducing potential of infinite loop. Perform field validations and apply field logic to improve user input and experience
Rollup Fields On Save / Every 1-12 hours / When User Presses Rollup Refresh Button Asynchronous / Every 1-12 hours

Rollups are calculated by scheduled system jobs Settings > System Jobs > View > Recurring System Jobs. System Job type: Mass Calculate Rollup Field or Calculate Rollup Field

Server Related Entity / Parent Child Relationship Upto 1 Level Deep And / OR, not a mixure Whole Number

Decimal

Currency

Date

SUM / MAX / MIN / COUNT / AVG Cannot use other Calculated or Rollup fields as part of a rollup. Aggregate calculations of child entities. The difference between Calculated Fields is Rollup fields are not virtual, they are physical attributes. Such as no. of open opportunities, activities, revenue, etc.
Calculated Fields

 

OnSave Synchronous Server Entity/ Parent Child Relationship Upto1 Level Deep AND or OR , Not a mix of both
  • Single line of text
  • Option Set
  • Two Options
  • Whole Number
  • Decimal Number
  • Currency
  • Date and Time
ADDHOURS, 

ADDDAYS,

 ADDWEEKS,

ADDMONTHS,

ADDYEARS,

SUBTRACTHOURS,

SUBTRACTDAYS,

SUBTRACTWEEKS, 

SUBTRACTMONTHS,

SUBTRACTYEARS,

DIFFINDAYS, 

DIFFINHOURS,

DIFFINMINUTES,

DIFFINMONTHS,

DIFFINWEEKS,

DIFFINYEARS,

CONCAT,

TRIMLEFT, and TRIMRIGHT.

Two calculated fields cannot reference each other in their formulas

Floating point numbers cannot be used in calculated fields.

Won’t trigger workflow updates

Fields are virtual /not stored at the database level

Ability to populate a field with simple calculations based on other values and conditions on the form in a real time manner.   This alleviates the need for JavaScript in fairly straight forward scenarios such as adding days or months to a date, or adding or subtracting fields on the same entity.

Calculated fields can calculate based on other fields, including rollup fields and other calculated fields.

 

Business Rules

https://technet.microsoft.com/en-us/library/dn531086.aspx

Rollup Fields

https://technet.microsoft.com/en-us/library/dn832162.aspx

Calculated Fields

https://technet.microsoft.com/en-us/library/dn832103.aspx



mm
Author: Raz Dynamics
Razwan is a Microsoft MVP and Dynamics 365 Community Moderator responsible for developing Microsoft Dynamics 365 and CRM integrated solutions for over a decade. Razwan is responsible for delivering Dynamics 365 User Groups & CRM Saturday Conferences. Raz has developed many free community utilities for Dynamics 365 and CRM which you can download from this blog.