Contents
How to avoid maximum trigger Depth exceeded?
To avoid these kind of situation we can use public class static variable. We can solve this issue, you can set a condition on trigger so it will not be called recursively. In RecursiveTriggerHandler class, we have a static variable that is set to true by default.
What is maximum trigger Depth exceeded?
Maximum Trigger Depth Exceeded Error Salesforce occurs mainly due to recursion in the trigger. Recursion can occur because of many reasons. Recursion occurs when the same code is executed again and again. It can lead to an infinite loop and which can result in governor limit sometime.
What causes maximum trigger depth exceeded error in Salesforce?
Maximum Trigger Depth Exceeded Error Salesforce occurs mainly due to recursion in the trigger. Recursion can occur because of many reasons. Recursion occurs when the same code is executed again and again. It can lead to an infinite loop and which can result in governor limit sometime.
Why is my Trigger on after update generating an error?
This error is generating because your trigger on after update is running recursively. You can resolve this error by using a static boolean variable check. For eg. 2) Add a check if (triggerHelperClass.bool ==true) “// if u set the value as true in class, then true here”,in the first line inside trigger.
When to move trigger to process builder in Salesforce?
The way you have your trigger written, it appears you are creating an opportunity when an account is created, also before an account is updated and then again after the account is updated: I would eliminate this part of the trigger all together and move it to the process builder instead.
Why did apex trigger insertopp cause an unexpected exception?
Apex trigger insertOpp caused an unexpected exception, contact your administrator: insertOpp: execution of AfterUpdate caused by: System.DmlException: Update failed.