A trigger is running multiple times during a single save event in an org. how can this be prevented?
Answers
Answered by
1
The answer is Trigger.isExecute.
One of the major reasons why a trigger is running multiple times during a single save event is that the trigger execution statement is included along with a set of statements that must be performed repeatedly in a loop. To avoid such instances of multiple execution, the Trigger.isExecute command must be used.
Answered by
2
Explanation:
To avoid these kind of situation we can use public class static variable.
- In RecursiveTriggerHandler class, we have a static variable which is set to true by default.
- Once this trigger fired the static variable value will set to false and trigger will not fire again.
Similar questions