USE CASE: Creating Account Hierarchy Rollups without Coding

Share

Free Salesforce business guides to help admins/developers, project managers, sales managers, and decision makers. Download the free PDF series now: Reinventing Your Business, Reimagining Your Salesforce®.

Problem

Within Salesforce, it is not possible to do hierarchy rollups without Apex coding. Standard Roll-summary fields will not support these types of roll-ups.

Solution

This is one of Rollup Helper's most popular use cases. You can rollup information from one child record to another parent record and up to the grand-parent. Rollup Helper can even help you in cases where you want to roll-up information for parent and child records that are on the same object, such as is the case with child accounts to parent accounts, or child campaigns to parent campaigns. It is possible to have a rollup which will show a Grand Total Result from all Accounts in an Account Hierarchy.

In order to do this, you will need to create 2 rollups, and a formula field to give you your Grand Total Result. Below we will count the number of Contacts as an example. This can also be done for other rollup types as well with slight modifications where necessary. 

The first rollup will be a standard Count rollup.

Make sure you have a field to rollup to on Account. It should be named something similar to: Number of Contacts Under Account
This rollup will count the number of child records directly related to that specific Account Record.

Step 1: Select Account as Target object
Step 2: Select Newly created field as Target Field (Number of Contacts Under Account)
Step 3:

  • Select Object you are rolling up (Contact)
  • Select the appropriate Relationship field (AccountId)
  • Select Count as the rollup type (in this example we will not use a filter)
  • Save and run this setting


The second rollup necessary for this use case is going to be used in order to Sum the results of the first rollup, and store that calculation on the Parent Account.
The recommended name for the target field of this rollup is: Number of Contacts from Child Accounts

In order for this to Sum up multiple levels, you will need to create a formula field that will take the result of this Rollup plus the original Rollup to use as the source field.
The formula field will return a numeric result. It can be named Number of Contacts in Account Hierarchy
The formula itself will look something similar to,
Number_of_Contacts_Under_Account__c + Number_of_Contacts_from_Child_Accounts__c


Step 1: Select Account as Target Object
Step 2: Select Newly created field as Target Field (Number of Contacts from Child Accounts​​​)
Step 3:

  • Select Account as the Source Object
  • Select Parentid as the Relationship Field
  • Select Sum As the rollup Type
  • For the Source Field, select the Formula field which combines the first Rollup result with the result of this Rollup (Number of Contacts in Account Hierarchy)
  • Save and Run this setting after the first setting has completed calculating

Need help setting up hierarchy rollups?
Schedule a one-on-one demo

Easily Create a Custom Last Activity (Task/Event) Date Rollup Helper Use Case Library Count Contact Records With A Filter Applied
Chat Offline
Contact Us Here