Cheat Sheet for Declarative Lookup Rollup Summaries
Business Problem
We have records that are related to each other in Salesforce and need to roll up values to the parent record. We tried using roll-up summary fields, but we ran into one of these issues:
-
- Our records do not have a master-detail relationship, roll-up summary fields do not work on lookup relationships.
-
- Cannot use the following in roll-up summary filters:
-
- Formula fields
- Filter logic
- Relative dates
-
- Cannot use the following in roll-up summary filters:
-
- Reached the roll up summary limit for an object.
We need a different way to automate the update to these fields easily.
We have heard about this amazing, free, open source tool called Declarative Lookup Rollup Summaries, but need a little help figuring out how to install it. The documentation can be a little intimidating for someone new to Salesforce. This article will serve as your cheat sheet to get up and running fast!
Or continue on for a short tutorial below.
Note: The video tutorial goes way more in depth.
How to Install Declarative Lookup Rollup Summaries
-
- Go to the Salesforce.org MetaDeploy link for DLRS.
-
- Documentation can be found here.
-
- Go to the Salesforce.org MetaDeploy link for DLRS.
- Click Install Declarative Lookup Rollup Summaries button
![DLRS Package Installation1 DLRS Package Installation1](https://bluninjas.com/wp-content/uploads/2022/05/DLRS-Package-Installation1-1024x436.jpg)
- Click Log In to Install
![DLRS Package Installation2 DLRS Package Installation2](https://bluninjas.com/wp-content/uploads/2022/05/DLRS-Package-Installation2.jpg)
- Click Allow
![DLRS Package Installation3 DLRS Package Installation3](https://bluninjas.com/wp-content/uploads/2022/05/DLRS-Package-Installation3.jpg)
- Click Install
![DLRS Package Installation4 DLRS Package Installation4](https://bluninjas.com/wp-content/uploads/2022/05/DLRS-Package-Installation4-1024x511.jpg)
- When the Installation Progress = 100% Complete, click View Org.
![DLRS Package Installation5 DLRS Package Installation5](https://bluninjas.com/wp-content/uploads/2022/05/DLRS-Package-Installation5-1024x537.jpg)
Now, we are ready to create our first roll-up! In our example, we want to count the number of closed won Opportunities a Contact is related to. Contacts are related to Opportunities via Opportunity Contact Role records.
- First you need to create the field that is going to hold the data. We created a number field called # Closed Won Opportunities on the Contact object.
![DLRSClosedWonOpps1 DLRSClosedWonOpps1](https://bluninjas.com/wp-content/uploads/2022/05/DLRSClosedWonOpps1-1024x520.jpg)
- Go to the 9 dots -> Search for Manage -> Click Manage Lookup Rollup Summaries
![QuizAppDRLS1 QuizAppDRLS1](https://bluninjas.com/wp-content/uploads/2023/05/QuizAppDRLS1.jpg)
- Make sure it says Create new...
![QuizAppDRLS2 QuizAppDRLS2](https://bluninjas.com/wp-content/uploads/2023/05/QuizAppDRLS2.jpg)
-
- Enter the following information:
- Lookup Rollup Summary Name: Contact | # of Closed Won Opps
- Lookup Rollup Summary Unique Name: Contact_Number_of_Closed_Won_Opps
- Parent Object: Contact
- Child Object: OpportunityContactRole
- Relationship Field: ContactId
- Relationship Criteria (this is the where clause of the SOQL query): Opportunity.IsWon=True
- Relationship Criteria Fields:
-
- Field to Aggregate: Id
- Aggregate Operation: Count
- Aggregate Result Field: Closed_Won_Opportunities__c
- Calculation Mode: Realtime
- Calculation Sharing Mode: System
- Then click -> Save
- Enter the following information:
Make sure to leave the Active checkbox set to false if this is your first roll up on the Contact object. You will not be able to save the record if it is true because we have to deploy the trigger first.
![DLRSClosedWonOpps2a DLRSClosedWonOpps2a](https://bluninjas.com/wp-content/uploads/2022/05/DLRSClosedWonOpps2a.jpg)
- Click Manage Child Trigger
![DLRSClosedWonOpps2b DLRSClosedWonOpps2b](https://bluninjas.com/wp-content/uploads/2022/05/DLRSClosedWonOpps2b-1.jpg)
- Click Deploy
![DLRSClosedWonOpps3 DLRSClosedWonOpps3](https://bluninjas.com/wp-content/uploads/2022/05/DLRSClosedWonOpps3.jpg)
- Click Cancel -> I know this seems weird but if you click Remove it will uninstall the trigger. Cancel will take you back to the previous screen.
![DLRSClosedWonOpps4 DLRSClosedWonOpps4](https://bluninjas.com/wp-content/uploads/2022/05/DLRSClosedWonOpps4.jpg)
- Click Active checkbox to set it to true
- Click Save
- If you have existing records that need to be calculated click Full Calculate. If not, you are all set!
![DLRSClosedWonOpps5 DLRSClosedWonOpps5](https://bluninjas.com/wp-content/uploads/2022/05/DLRSClosedWonOpps5.jpg)
For any questions, comments, concerns – let us know in the comment section below!
We would love to hear from you!