You need to sign in to do that
Don't have an account?

How to make a trigger run only when Static variable of a class is false?
Hi All,
I have an Apex class Class1 with method1,method2 and method3 in it, i would like to set a static variable V1=True initially and have below trigger to be run when the Static variable V1 is false.
Thanks
CvK
I have an Apex class Class1 with method1,method2 and method3 in it, i would like to set a static variable V1=True initially and have below trigger to be run when the Static variable V1 is false.
trigger Trigger1 on Account (before insert, before update) { if((Trigger.isInsert || Trigger.isUpdate) && Trigger.isBefore){ Class1.Method1(Trigger.new); Class1.Method2(Trigger.new); } if((Trigger.isInsert || Trigger.isupdate) && Trigger.isAfter){ Class1.Method3(Trigger.new,trigger.old); } }Help will be appreiated,
Thanks
CvK
Please try the below code. If your static variable is true, then the trigger won't run.
Thanks,
Benazir.