Hi Mohit,
One workaround is to set a private static variable in a global class so it works as a flag, not avoiding the trigger fires twice instead it avoids overpassing the limits.
Something like this. Create a Validator Class:
global class Validator_cls{ private static boolean blnAlreadyDone = false; public static boolean hasAlreadyDone(){ return blnAlreadyDone; }
public static void setAlreadyDone() {
blnAlreadyDone = true;
} }
In the trigger include a line like this one:
trigger OpportunityTrigger_tgr on Opportunity (before insert, before update) { if(!Validator_cls.hasAlreadyDone()){ // Your trigger code here Validator_cls.setAlreadyDone(); } }
So, when the trigger is fired by the first time it sets the flag in true and at the second time it won’t pass again over the executed code.