4 Ways to Create Roll-Up Summary Fields on Lookup Relationships in Salesforce

Share this article...

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:

  1. An AppExchange App
  2. A Flow
  3. Apex Triggers
  4. Reporting

Each of these methods has its pros and cons. 

#SolutionProsCons
1AppExchange App• Easy setup

• Tested

• No development

• More efficient for multiple fields

• More advanced functionality

• Licensing costs
2Flow• No coding skills required
• No licensing
• Effort to build and test
3Trigger• More flexible compared to flow
• No licensing
• Effort to build and test
• Needs coding skills
4Reporting• 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.

AppExchange Solutions

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 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.

Check out our guides, complete with walk-throughs, on how to use Rollup Helper and DLRS to create roll-up summary fields on lookup relationships!

Summary

Now you understand the various options available to you, don’t forget to take a look at our guides:

What’s your favorite way to create roll-up summary fields on Lookup relationships? Let us know in the comments!

16 thoughts on “4 Ways to Create Roll-Up Summary Fields on Lookup Relationships in Salesforce

  1. Just a quick correction for anyone doing a search for the tool – it’s actually DLRS (declarative lookup rollup summary), not DRLS. Or, the link above works just as well. I’ve used this one, and for what I’ve used it for, it works really well. Never tried using the Flow method though.

      1. I mispell this all the time! For me, I keep trying to type “DSLR” because it’s a common camera type. However, one trick that helps me to remember the acroynm is the name “Dolores” –> DoLoReS –> DLRS. Basically I just have to picture Dolores Umbridge from Harry Potter 🙂

  2. Just started using DRLS, which seems like a pretty neat solution. Hadn’t considered the flow route, but I like your thinking!

  3. Flow works well too in case if anyone doesn’t want to use the app. App may be useful when the requirement is in many objects, otherwise Flow should be enough.

  4. Example shows roll up summary created in Account using opportunity field. Isn’t relationship between Account and opportunity is Lookup?

    1. Hi Leonardo!

      The relationship between Account and Opportunity is a special type of lookup relationship in Salesforce! Salesforce treats specific standard object relationships in a hybrid way e.g. they combine lookup and master-detail functionality.

      We’ve simply used the Account/Opp example to demonstrate what a roll-up looks like and what functionality it provides. Hope this clarifies things for you!

  5. How do you then add a rollup summary to calculate number of accounts related to a contact using flow? Do we use the same trigger ?

Add Comment