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
Venk_ModelMetriVenk_ModelMetri 

Obtaining the Parent (most) Account for an opportunity.

Hello,

 

When I have an opportunity record, I can obtain the account that owns the current opportunity by using

 

opportunity.accountId;

Since accounts can have parent accounts, I am interested in obtaining the parent most account (root) for any specific opportunity.

Is there any easy way to do it? (Or we do have go to the account record and obtain the account.parentId; recursively to get the root account id)

 

Thanks

Venk

 

 

DevAngelDevAngel
You will have to walk your way up the Account tree.