Admins

How to Create Roll-Up Summary Fields in Salesforce with Rollup Helper

By Vasilis Papanikolaou

Salesforce Account hierarchies are great for modelling large organisations. However, when it comes to rolling data up the hierarchy, things can be harder than imagined. 

Generally, roll-up summary fields can be used to roll-up data from child to parent records. Roll-up summaries are really easy to set up, but they only work for Master-Detail relationships and the account hierarchy is not built on Master-Detail relationships.

In this article we’ll dive into how you can use Rollup Helper to create roll-ups that can span multiple levels of a hierarchy (and more!).

Salesforce Rollup Helper Walkthrough

Let’s work with a relatively common scenario. We have a global hierarchy of accounts and we’d like to know how the amount ($ value) of closed opportunities rolled up the hierarchy, so we can see the full amount value on the very top parent account. 

There are a couple of things to consider before starting to work on the roll-ups. We can roll up the amount of closed opportunities to the related account with a roll-up summary field. Let’s call that field Closed Deals (Closed_Deals__c). The roll-up type should be SUM of the Amount field and we’ll also need to filter the Opportunity records with Won equals True.

Let’s think a bit about how to roll up the Closed Deals field to accounts higher in the account hierarchy. I have set up an example in Figure 1 to make it easier.

Fig. 1: Example of an account hierarchy with closed opportunities.

Acme is a global account with a number of entities around the world. The European country accounts fall under the Europe account and the Europe account falls under the global entity. 

There is also a US account under Acme Global. Each account has its own closed deals, based on the opportunities directly related to it. Acme Spain has Closed Deals = $240k and Acme Europe has Closed Deals = 100k since only one opportunity is directly related to it. 

I’m assuming that every account in the hierarchy can have direct opportunities. Therefore we need to create 2 more fields. One to capture the opportunities of the account’s children (Acme Germany and Acme Spain for Acme Europe) and one to capture the sum of opportunities of children and direct opportunities.

  • Closed Deals of Children (Closed_Deals_of_Children__c): sum of opportunities of all the children related to the account. This is a simple Currency field with a default value of 0.
  • Closed Deals Total (Closed_Deals_Total__c): opportunities of all the children plus the direct opportunities. This is a simple formula field with the formula Closed_Deals_of_Children__c + Closed_Deals__c.

Using the 3 fields that we have defined, we can start configuring our roll-ups in Rollup Helper.

Installing Rollup Helper

Let’s install the app first. You can get the free version of the app from AppExchange here.

You can configure up to 3 roll-ups before having to upgrade to the premium version.

Fig. 2: Installing the App

Fig. 3: Install for all users

After successfully installing the app you can find it in your org.

Fig. 4: The Rollup Helper dashboard.

Creating a New Roll-up

The next step is to create our roll-up. We want to sum the Closed Deals Total field of child Account records into the Closed Deals of Children field on the parent Account record.

Fig. 5: Click Create A New Rollup from the dashboard
Fig. 6: Selecting the destination object

This is an Account to Account roll-up so the destination object should be set to Account.

Fig. 7: Selecting the target field in the destination Object

The target field is where our roll-up will reside. In our case, we have already created the field on the Account object so we can select it from the list. Otherwise, we can create it at this point.

Fig. 8: Selecting the source Object and relationship
Fig. 9: Selecting the source field and roll-up type

The source object for Account hierarchy should be set to Account and the relationship field is the Account.ParentId. 

We should then set the type of the roll-up to SUM and select the Closed Deals Total field as the source field. 

In this scenario there is no need for a filter on the child records but if required,  we could create one and only use some of the child records in the roll-up calculation. 

The next step is to hit the Save & Run button to save it and run the roll-up for the first time.

Fig. 10: Activating the roll-up.

The last step is to activate the roll-up from the All Rollups tab in the Rollup Helper app. Rollup Helper will create a trigger, based on our configuration and the values in the child records will update the parent records automatically.

Fig. 11: Checking the results for the account hierarchy example of Fig. 1

Summary

That’s it, we have created our roll-up and now we have a complete view of the value of closed opportunities across the account hierarchy. Following the same steps, we can create a number of roll-ups for various metrics for our Accounts and other objects as needed!

Disclaimer: The author has no affiliation with Passage Technologies, the developer of Rollup Helper, nor has he received any compensation for the article.

Read more:

The Author

Vasilis Papanikolaou

Vasilis is a Salesforce consultant, developer and Partner at Robin Consulting.

Leave a Reply

24th - 27th November

BLACK FRIDAY

50% off

all courses

Go to COURSES