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
Raghu NaniRaghu Nani 

Maximum trigger depth in salesforce

Hi friends,

Usually after Update trigger will gives the error saying maximum Trigger depth Exceeded.
How many times trigger will execute to reach this error Or in other words What is the depth of the trigger?



Thanks,
Raghu
Best Answer chosen by Raghu Nani
Malni Chandrasekaran 2Malni Chandrasekaran 2
Raghu,
Normally 'Maximum Trigger depth Exceeded' error occurs when a trigger recursively invoke triggers more than 16 times (Maximum stack depth).
To avoid this we have to break the recursive call. One way is to use static boolean flag whereever your business logic permits.

If you find this helpful, please mark it as Solved.
Thanks.

All Answers

Malni Chandrasekaran 2Malni Chandrasekaran 2
Raghu,
Normally 'Maximum Trigger depth Exceeded' error occurs when a trigger recursively invoke triggers more than 16 times (Maximum stack depth).
To avoid this we have to break the recursive call. One way is to use static boolean flag whereever your business logic permits.

If you find this helpful, please mark it as Solved.
Thanks.
This was selected as the best answer
AvaneeshAvaneesh
Hi Raghu,

"Maximum Trigger Depth Exceeded" error show when you are under recurison condition to slove this recursion used one static boolean variable 
to slove recursion check this link 
https://help.salesforce.com/articleView?id=000133752&type=1

mark as best answer if this is helpful.
thank you 
Avaneesh Singh
 
Pradeep Gupta 18Pradeep Gupta 18
Hi, 
will the initial transaction which started the recursive triggger to five will be commuted after the stack depth error? Or entire transaction will be rolled back after the error?