9th Day of CRMas: Rollups Help Santa with Naughty/Nice Conundrum
Welcome to Day 9 of our 12 Days of CRMas. In this blog series, we have been exploring the best and brightest of Microsoft Dynamics CRM 2015's new features. Today we'll take a look at rollup fields.
In previous versions of Microsoft Dynamics CRM, rollups were possible, but required development and utilized jscript, plug-ins, business rules and workflows. In Microsoft Dynamics CRM 2015, rollup and calculated fields are included out of the box and can be utilized by business users. They are executed server-side and updated synchronously, so you will see the updates immediately when you save the record.
In this example, we'll use rollup fields to help out Santa with Naughty/Nice rollups and calculations
Santa needs to understand how many activities last year were naughty versus nice. First, we created custom activities called 'Naughty' and 'Nice'. These help the big guy record activity for the two most important types of activities in kid life.
- Create a rollup field for Nice activities
- Go to Settings > Customization
Contact > Customize Entity
- Select Fields, click New
- Display name = 'Nice Activities'
- Data type= 'Whole Number'
- Field type = Rollup
- Define Rollup
- Edit the Field Type
- Under Related Entity, add 'Nice Things'
Click Add Condition under Filters
- Condition: If Nice Thing – Contains Data
- Select 'Count' and 'Nice Things'
- Repeat for 'Naughty Things'
Now we want to see our data.
In Contact edit form
- Drag and drop 'Nice Things' and 'Naughty Things' onto the form. These are the rollup fields.
- Drag and drop the '…(Last Updated On)' and '….(State)' fields on the form. This will help Santa and Co. know how current the rollup data is.
There are a couple of options for updating Rollup data. Each time you create a rollup field, a Mass Calculate Rollup Field System job is created. These are run every hour by default, but you can change the recurrence pattern or do a real time calculation from an individual form (pictured). The State field = 1 tells us it was updated correctly. States of 2, 3 and 4 are error codes.
A few other considerations when using Rollup fields:
- Workflow event/wait conditions
- ModifiedBy/ModifiedOn not updated
- Max 100 per org/10 per entity
- No rollups of rollups
- No complex calculated fields
- Only 1:N relationships
- Last calculated value