Declarative Lookup Rollup Summaries (DLRS)
- Create Field where Rollup Data will appear
- Install the DLRS tool
- Create Remote Site Settings
- Define Rollup Summary
- Manage Child Triggers + Deploy
- Mark as Active
1. Create Field where Rollup Data will Appear
For this example, number field with label Number of Campaigns Responded placed on the Contact object (Parent object, where the rollup will appear).
2. Install the DLRS Tool
Go here: https://github.com/afawcett/declarative-lookup-rollup-summaries, then scroll down to “Package Release History,” and use the Production URL/Sandbox URL links as appropriate. Select “Install for All Users” when presented with the package install screen.
Once installed, DLRS will show up as an app in the org.
3. Create Remote Site Settings
This step was not required for my Trailhead org using version 2.12 of the DLRS tool.
4. Define Rollup Summary
Define various fields on the Manage Lookup Rollup Summaries tab
|Field||Value for Example||Description|
|Lookup Rollup Summary Name||Number of Campaign Responses|
|Lookup Rollup Summary Unique Name||Number_of_Campaign_Responses||No Spaces|
|Parent Object||Contact||Object with the Rollup field displayed|
|Child Object||CampaignMember||Object being aggregated, API Name|
|Relationship Criteria||HasResponded=True||Subsets the records that are aggregated|
|Relationship Criteria Fields||HasResponded||2|
|Field to Aggregate||id|
|Aggregate Result Field||Number_of_Campaigns_Responded__c||Field that will hold the result|
|Aggregate all Rows||Checked||4|
1: Where is the relationship field that relates the Parent to the Child, in this case located on CampaignMember, Field Name for field with Data Type Lookup(Contact)
2: Copy all the fields in the Relationship Criteria field into this field
3: Sum, Max, Min, Avg, Count, Count Distinct, Concatenate, Concatenate Distinct, First, Last
4: If checked, will include archived records and records in recycling bin
5. Manage Child Triggers + Deploy
On the Manage Lookup Rollup Summaries tab, click the Manage Child Trigger button. Then, click the Deploy button at the bottom.
6. Mark as Active
Note: need to deploy before setting as Active.
Set as Active from the Manage Lookup Rollup Summaries tab. Select the “Active” checkbox. Save.
Click the Full Calculate button. If Calculation Mode is set to Realtime, the field will calculate every time the triggering fields are updated.
Some other useful DLRS reference info: