답변 5개
Hi Krishna,We can use a static variable to prevent code to be executed. As per the order of execution, all Before Trigger and After Trigger will fire before the workflow update. To prevent Trigger to be fired the second time, after workflow field update we can set a static boolean variable in a Class.Create a static variable in a class as true. Make it false before or after a trigger has been executed. Variable will become false when trigger runs for the first time (before workflow update). If the variable is true only then trigger will fire and if the trigger will try to execute the second time then it will not fire.Handler Class: public class TestHandler{
public static Boolean isTriggerExecuted = true;
}
Trigger:
I hope it helps you.Kindly mark this as solved if the information was helpful.trigger testTrigger on Account (before update){
if(TestHandler.isTriggerExecuted){
//Logic
TestHandler.isTriggerExecuted = false;
}
}
Regards,
Khan Anas