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
CKRCKR 

Why static boolean variable ? why not just boolean variable to use inorder to avoid recursive triggers?

Hi All,
Learnt a bit about how to avoid recursive triggers, now i wonder, Why static boolean variable ? why not just boolean variable to use inorder to avoid recursive triggers?
Nitin SharmaNitin Sharma
Use Static boolean variable because static variable always maintain its state. 
Create one public class with static boolean variable "True". 

Use below link for more details 
http://www.cloudforce4u.com/2013/07/avoid-recursive-trigger-salesforce.html
http://amitsalesforce.blogspot.in/2015/03/how-to-stop-recursive-trigger-in.html

Mark, it as best answer if it solve ur problem. 

Thanks,
Nitin Sharma

 
JeffreyStevensJeffreyStevens
Because each time a trigger is invoked - the standard boolean variable get's re-created and instansatiated with each call of the trigger.  By using a static variable, in an outside class - the variable retains it state throughout the entire invocation stack.
mohit prabu 7mohit prabu 7
Thank you!