You need to sign in to do that
Don't have an account?
MaheemSam
How to get grand parent
Hi,
I have a below query which will display parent, grand parent till top 5 grand parent can we do this using apex which should automatically display parents till top parent Please suggest me
Thanks
Sudhir
I have a below query which will display parent, grand parent till top 5 grand parent can we do this using apex which should automatically display parents till top parent Please suggest me
select id, Name, ParentId, Parent.ParentId, Parent.Parent.ParentId, Parent.Parent.Parent.ParentId, Parent.Parent.Parent.Parent.ParentId from Account where ParentId != null and id = '0013400001S5ZTm'
Thanks
Sudhir
Accessing grandparent through SOQL.please refer the below link for reference.
- https://developer.salesforce.com/forums/?id=906F0000000BIGlIAO
- https://salesforce.stackexchange.com/questions/57878/best-way-to-query-child-grandchild-from-parent
- https://salesforce.stackexchange.com/questions/124311/accessing-grandparent-through-soql
Hope it will be helpful.Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.
Thanks
Rahul Kumar
Thanks for you reply I already have it in a SOQL I need this something in APEX where just passing a account id I need all the garand parent list to be displayed till the top level let me know if you can help in code.
Thanks
Sudhir
I have a custom Object Expense Item Which having the parent in the below hierarchy...
Mark, it as best answers so that this question will be filtered out from unsolved questions.
Thanks
Regards Sharad
WHERE Id =:'0013400001S5ZTm'.