Link Child Accounts to Ultimate Parent Account in Salesforce

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: You want to link an Account with its ultimate parent Account.

When you have multi-level account hierarchies, there are benefits to having all child accounts directly related to the top level account. For example, it can make it easier to pass information down from the top level parent, or to aggregate information up to that level without having to traverse multiple relationships.

Solution: The first step of this setting is to create a formula field on Account, which will return the id of the top level account from the Account Hierarchy.

The name of this field can be Ultimate Parent Formula LH. Here's a sample of this formula:

IF(NOT(ISBLANK(Parent.Parent.Parent.Parent.Parent.Parent.id)), Parent.Parent.Parent.Parent.Parent.Parent.id,
IF(NOT(ISBLANK(Parent.Parent.Parent.Parent.Parent.id)), Parent.Parent.Parent.Parent.Parent.id,
IF(NOT(ISBLANK(Parent.Parent.Parent.Parent.id)), Parent.Parent.Parent.Parent.id,
IF(NOT(ISBLANK(Parent.Parent.Parent.id)), Parent.Parent.Parent.id,
IF(NOT(ISBLANK(Parent.Parent.id)), Parent.Parent.id,
IF(NOT(ISBLANK(Parent.id)),Parent.id,
null))))))
This formula goes up six levels to get the ultimate parent's id, and it can also be modified to go further.

Once the formula is created, you'll need to create the Lookup Field that will be populated by Lookup Helper. This will be a Lookup to the Account Object; it can be named "Ultimate Parent Account."

After this field has been created, you can go into Lookup Helper to create the setting.

Ultimate parent account image

  • The first choice will be to select the Child Object, which in this case is "Account"
  • Then select the Ultimate Parent Account Lookup Field we created earlier
  • On the next page, select the Ultimate Parent Formula LH as the matching field on the Child Object and the Account ID as the matching field on the Parent Level
  • Once you have made these selections, just save and run the setting
Number of Tasks From Lead Owner Lookup Helper Use Case Library Group All Opportunities for Companies in a Specific Industry