Use Business Rules to Update Values from Rollup Fields
Posted on: February 21, 2017 | By: Craig Thompson | Microsoft Dynamics CRM
Authored by: John Hinchy
In a previous blog, ‘Keep Track of How Often You Contact your Clients with CRM 2016’, I touched on some of the many benefits of using Rollup Fields in Dynamics 365. Using rollup fields users can aggregate data from records to calculate counts of opportunities, average amounts of different fields, or the last date an activity took place. The user can even look for more specific data across related records. For example, total estimated revenue for an account across all of the account’s opportunities.
With all the new benefits rollup fields provide though, these fields do have some limitations. You can only have 10 rollup fields per entity and 100 rollup fields per organization, a workflow wait condition cannot be used on a rollup field, and a rollup over another rollup is not supported. The most important limitation though, is that a workflow cannot be triggered by a rollup field update. This is very important to note, because once every hour, a system job runs in the background to update the rollup field. This job calculates the settings the user has in place and enters the updated value in the rollup field. When using a workflow to update information, such as an account field with a piece of information from a contact, you need a change on the form to trigger the workflow. If the rollup field change will not trigger this, you need something else that will.
To get around this, the user has the ability to use Business Rules to update another field with the rollup field’s value. By populating another field with the information from the rollup field, you can use the change in the new field to trigger a workflow. In my scenario, I have created a rollup field called Last Contact Date, indicated by the lock and calculator icons in the image below. This field looks at the activity entity and enters the date of the last completed activity on the account. Now, before we create a business rule, we need a field that is not a rollup field to store this date. I have created a ‘Date’ field called Account Contacted Date to do this. Next, you will create a business rule that populates the newly created date field with the rollup date.
Creating the Business Rule
To create your business rule, you will first open your entity form and click on business rules in the header. Note – You will need system administrator access to make changes to the entity and forms. Click on new business rule to bring up the business rule screen. With the introduction of CRM Online the business rule creation layout has been updated to allow users to visually see the flow of the rules they create. Name your business rule and click on New Condition to set your first condition. In this scenario, we want to check IF the new ‘Date’ field we created ‘Is less than’ the rollup field date. Because we are populating this date with the business rule when the rollup field is updated, the new date should always be less than the rollup field date and meet the condition. For our THEN statement we want to update the new date field, so we choose Set the new date field to the rollup field date’s value.
This rule will now input the rollup field’s date into the new date field when the rollup field is changed because the date will be before the new date field. (Refer to the above image for the actual inputs on the condition). Now save and Activate your business rule to begin using it.
Two important steps to remember when creating your business rule are to validate and set scope.
Along with the updated business rule interface, you now have the ability to click the button for Validate to ensure your conditions meet logical criteria that is accepted by the system and will not give errors. Scope is used to set your business rule at the entity or form level. If you have your scope set to the form, the business rule will run when your changes are made while you are working within the form. If you set your scope to the entity level, your business rule will trigger even if the form is closed.
If you think that a CRM system is your next best step for your business, Logan Consulting your Microsoft Dynamics CRM partner of Chicago.
How to Double your ROI with Cloud Solutions
Top 10 Inventory & Operations Decisions Distributors Are Making Blind
2020 Nucleus Research Report on ERP Technology