Creating roll-up summary fields on the master object in a Master-Detail relationship is relatively straightforward. The majority of Salesforce Admins will be comfortable creating roll-up summary fields, as well as the limitations around them. Speaking of limitations, roll-up summaries are really easy to set up, but they only work for Master-Detail relationships! There are two very popular (and old) ideas on the subject but it seems the ability to create roll-up summary fields on Lookup relationships won’t be coming anytime soon.
In this article we’ll review your options for working around this limitation, and dive into the various ways you can create a roll-up summary on a Lookup relationship in Salesforce.
What is a Roll-Up Summary Field?
A roll-up summary field is one that aggregates data from a child object to a parent object that share a Master-Detail relationship. Roll-up summary fields can use the COUNT, SUM, MIN and MAX functions. For example, we could use a roll-up summary field to display the total value (amount) from Opportunities on a related Account.
Even better, roll-up summary fields can have filter criteria, so we could choose to display the total Opportunity value from won opportunities on a related Account.
Unfortunately, roll-up summary fields are only available for objects in a Master-Detail relationship and are not available for those that have a Lookup relationship.
4 Ways to Create a Roll-Up Summary in Salesforce
There are 4 ways one can work around this:
- An AppExchange App
- A Flow
- Apex Triggers
Each of these methods has its pros and cons.
|1||AppExchange App||• Easy setup|
• No development
• More efficient for multiple fields
• More advanced functionality
|• Licensing costs|
|2||Flow||• No coding skills required|
• No licensing
|• Effort to build and test|
|3||Trigger||• More flexible compared to flow|
• No licensing
|• Effort to build and test
• Needs coding skills
|4||Reporting||• Relatively low effort|
• No licensing
|• Rolled up metrics not available as fields in the record
• Not visible in list views
• Not usable in flows, triggers, validations & formulas
Salesforce Native Solutions
There are multiple ways of creating a roll-up summary field on a Lookup relationship using native Salesforce functionality, but the most powerful AND accessible way is to use Flow.
Rolled-up values in reports have many limitations and need to be created for each report you wish to see the values in.
You could use an APEX trigger, however this requires coding skills and if any changes are required in future, an Admin won’t be able to easily update a trigger.
Check out our complete walk-through on how to create roll-up summary fields using Flow here.
There are a number of app listings in the AppExchange that can do roll-ups on Lookup relationships, as well as an open-source tool.
Some example include:
- Rollup Helper: paid and free version
- Roll-It-Up: paid
- DLRS – Declarative Lookup Rollup Summaries Tool: open source, free
Rollup Helper is easy to use and there’s a limited free version. DLRS is a good alternative if cost is an issue and you’re ok with just community support since it’s an open-source project.
Now you understand the various options available to you, don’t forget to take a look at our guides:
- How to Create Roll-up Summary Fields in Salesforce with Rollup Helper
- Guide to Salesforce DLRS (Declarative Lookup Roll-up Summaries)
- Create Roll-Up Summary Fields Using Salesforce Flow
What’s your favorite way to create roll-up summary fields on Lookup relationships? Let us know in the comments!