“Rollup Field” is a new feature introduced in CRM 2015 which can be used for setting up extended fields to store aggregated values. The key benefit is, this can be setup from CRM UI without any code.
Let’s have a look at how to setup this field type and the scope of this field type in implementations.
Here the requirement is to create a field to count the number of Opportunities in an Account which are in ‘Won’ status and add it to the Account form.
Steps to create the Rollup field:
- Setting up ‘Rollup Field’ is just like any other field in an entity and can be done from Settings>Customizations>Solutions ~ Components> Entities> {Entity} > Fields >New
- Enter field details:
- Click on ‘Edit’ to create the field and to open a new window to configure the field:
- Once the field is created, it will open the window to configure the field
a. Configure the Related Entity – In this case the Opportunities
b. Next configure the Filter condition
c. Next choose the Aggregate function – There are multiple aggregate functions to choose from based on the requirement.
- In this case, I would choose the ‘COUNT’
- Finally, the configuration window would look like
- Add the field to the Account form as well.
- Let’s open the Account screen now. Screen now shows the count of ‘Won’ Opportunities.
Here I just demonstrated a very simple usage of the Rollup field and can be used for getting the real business benefits to improve the CRM solution!
PS: When we create a Rollup field, it also creates a status and last calculated date fields as well.
From DB it looks like – Additional int (state) and datetime (Last calculated date) fields are added when adding a single Rollup field from CRM UI: