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
Bhulesh deshpande 3Bhulesh deshpande 3 

Level deep I can go for self lookup trigger

Hello Guys, 

I have an interesting scenario. I have self lookup on a custom object. When the parent is updated, I have to update the child. There can be upto 15 levels deep records. How would I go to achive this? Any thoughts, recomondations highly appreciated.

Thanks for your time!

Shailesh
Sumitkumar_ShingaviSumitkumar_Shingavi
You have to run recursion (recusrsive loop) until "ParentId != Null". I think, Apex will handle 15 level deep recursion. It really will through exception when you hit catche size due to recursive loops where intermidiate results are stored.

PS: if this answers your question then hit Like and mark it as solution!
Bhulesh deshpande 3Bhulesh deshpande 3
Hello Sumit thanks for your response .

I have another issue could you please help me to solve the issue..?
Bhulesh deshpande 3Bhulesh deshpande 3
The senario is I want to perform insert and update operation on Case object and execute different operations on the basis of this before trigger execute.

The thing is I have wrote a before trigger and used three helper classes for insert, update and operation process .not getting error after saving entire apex code  but while updating record I am getting ,

An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. 

Thank you again for your patience and assistance. And thanks for using salesforce.com!
Error ID: 1825935943-342219 (1204153959)

This eror please let me know the solution idf you know.

What could be the reson i am getting this error...?