function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matthew LohMatthew Loh 

Is there a formula to check if an account is a Parent Account and display True/False?

I'd like to be able to see from the Accounts level stage if an Account is a parent of something else, without clicking "View Account" hierarchy.

Now I was going to automate this by using this "true/false" field and then using the Highligher Salesforce app to highlight the field in a certain colour if it was a parent account, or it was a child account

This way I can look at the Account and depending on the colour, automatically know if it was a parent or a child account.

I swear there is an ability to create an IF function for this, but I don't know how to set the parameters to check to see if an account has a hierarchy
Best Answer chosen by Matthew Loh
Akhil AnilAkhil Anil
Hi Matthew,

Since you have multiple levels of parent child relationship, the formula I posted before won't work. In your case you will have to create a roll-up field that will count the number of child records and have another formula field to check the count of the records and flag it as Parent or Child.

To create a roll-up summary field you will have to go with an appexchange package like below and then create a field named something like "Child_Count__c"

https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009i3UpEAI

Your formula field for flagging the account as parent or child would then have the below formula.
 
Child_Count__c > 0

That should work out for you for all levels of the parent-child relationship.

 

All Answers

Akhil AnilAkhil Anil
Hi MAtthew,

You need to create a formula field of the Type Checkbox and your formula will be simply this.
 
ISBLANK(ParentId)

If the formula evaluates to true, it will check the checkbox to TRUE which means it is a Parent Account, else set it to FALSE which means it is a child account.

Kindly mark it as an answer if that works !
Matthew LohMatthew Loh

Hey Akhil

I tried your formula and it works for top level parent accounts, but it doesn't show the checkbox when there is more than one level of hierarchy in an account family.

For example if we had Grandfather --> Father, when I view Grandfather the checkbox would be TRUE

But if I had Grandfather -->Father --> Son, when I view FATHER the checkbox is FALSE, even though I have stated that it is the parent of the Son account

Even though I have clearly stated on the Son account that the parent account is the Father, and on the Father account that the parent is the Grandafther.

Only the Grandfather account itself shows the checkbox = TRUE.

Can you please help? Thanks

Akhil AnilAkhil Anil
Hi Matthew,

Since you have multiple levels of parent child relationship, the formula I posted before won't work. In your case you will have to create a roll-up field that will count the number of child records and have another formula field to check the count of the records and flag it as Parent or Child.

To create a roll-up summary field you will have to go with an appexchange package like below and then create a field named something like "Child_Count__c"

https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009i3UpEAI

Your formula field for flagging the account as parent or child would then have the below formula.
 
Child_Count__c > 0

That should work out for you for all levels of the parent-child relationship.

 
This was selected as the best answer
Matthew LohMatthew Loh
Thanks so much Akhil!!! 
Kai MederKai Meder
Akhil's answer does not make any sense.
ISBLANK(ParentId) TRUE means that the account does not have any parent but can very well be a parent to other account's as well - you don't know
ISBLANK(ParentId) FALSE means that the account does not specify any parent but can very well be a parent to other account's as well - you don't know

that's the actual problem with salesforce only having the parent-information at the children and no way to know at the parent's level.

The above mentioned AddOn "Rollup Helper" seems to do the job but the free edition is limited to 3 rolls ups, unlimited costs around ~1700 eur/year
Kai MederKai Meder
or put more simple:
ISBLANK(ParentId) TRUE - account is not a child of anyone
ISBLANK(ParentId) FALSE - account is a child of ParentId