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
rajaram.adminrajaram.admin 

1.when did use recursive trigger?How to stop recursive Trigger? one example explain

Laxman RaoLaxman Rao

Some times the record may cause another trigger to fire, which in turn causes another to fire, and so on.

To stop this we use static boolean.

 

Refer this

 

http://www.salesforce.com/docs/developer/cookbook/Content/apex_controlling_recursive_triggers.htm

Ritesh AswaneyRitesh Aswaney

Trigger recursion happens when updating a record in a trigger causes the trigger to fire itself again.

For example, if you had an after trigger on Opportunity, where you update the Opportunities that fired the current execution of the trigger, it will cause a domino effect - i.e. recursion.

 

To prevent recursion, you set an 'executing' static variable in a class, which is unique across the execution context.

Using the static variable as a 'semaphore' you can skip out of logic when the trigger is invoked for a 2nd time.