3

We have a requirement for some account to have variable levels of parent accounts. Currently the salesforce account hierarchy only accommodates 2 levels of parents (grandparent, parent). Is there a solution to have more levels of parents for a specific account?

1
  • Also, you want to keep in mind the security settings for your org and the type of access you want parent account owners to have on child accounts and child account owners to parents. Per the help and training, "Sharing between accounts and child records. Access to a parent account—If you have access to an account’s child record, you have implicit Read Only access to that account. Access to child records—If you have access to a parent account, you have access to the associated child records. The account owner's role determines the level of access to child records." Jul 1, 2015 at 5:42

2 Answers 2

6

You can determine the ultimate parent in the hierarchy with this easy formula on the account object:

IF(LEN(Parent.Name) < 1, HYPERLINK("/"&Id, Name,"_parent"), 
 IF(LEN(Parent.Parent.Name) <1, HYPERLINK("/"&Parent.Id,Parent.Name,"_parent"), 
 IF(LEN(Parent.Parent.Parent.Name) < 1, HYPERLINK("/"&Parent.Parent.Id,Parent.Parent.Name,"_parent"), 
 IF(LEN(Parent.Parent.Parent.Parent.Name) < 1, HYPERLINK("/"&Parent.Parent.Parent.Id,Parent.Parent.Parent.Name,"_parent"),
 IF(LEN(Parent.Parent.Parent.Parent.Parent.Name) < 1, HYPERLINK("/"&Parent.Parent.Parent.Parent.Id,Parent.Parent.Parent.Parent.Name,"_parent"), 
 IF(LEN(Parent.Parent.Parent.Parent.Parent.Parent.Name) < 1 ,HYPERLINK("/"&Parent.Parent.Parent.Parent.Parent.Id,Parent.Parent.Parent.Parent.Parent.Name,"_parent"), 
 IF(LEN( Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name) < 1 ,HYPERLINK("/"&Parent.Parent.Parent.Parent.Parent.Parent.Id,Parent.Parent.Parent.Parent.Parent.Parent.Name,"_parent"), 
 IF(LEN(Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name) < 1 ,HYPERLINK("/"&Parent.Parent.Parent.Parent.Parent.Parent.Parent.Id,Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name,"_parent"), 
 IF(LEN(Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name) < 1 ,HYPERLINK("/"&Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Id,Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name,"_parent"),
 IF(LEN(Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name) < 1 ,HYPERLINK("/"&Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Id,Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name,"_parent"), "Ultimate Parent Beyond 10 Levels"))))))))))
2
4

The hierarchy can be as big as you like, I think your issue is related to the display of the hierarchy somewhere?

All accounts have a parent account field which is a lookup field, you can chain all the accounts in your org should you want to, but a limit you will hit is the number of relationships you can traverse in SOQL queries and formula fields. You can traverse through 5 levels of child to parent relationship as explained in the documentation:

In each specified relationship, no more than five levels can be specified in a child-to-parent relationship. For example, Contact.Account.Owner.FirstName (three levels).

If you need a way to visualise the hierarchy easily then a good starting point would be a free labs app on the AppExchange called Inline Account Hierarchy.

3
  • What about having one account with multiple direct parents? Jul 24, 2013 at 0:29
  • You could add more lookup fields, though if you want to use Master Detail relationships then you are limited to two of those per object type.
    – Matt Lacey
    Jul 24, 2013 at 0:35
  • I would say create a Junction object if you want to have multiple parents.
    – C0DEPirate
    Sep 16, 2015 at 6:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .