You need to sign in to do that
Don't have an account?
Maverick123
By pass an DML activity
Hello All,
I have a situation here, where i would like to by pass/avoid a DML acitivity and proceed ahead with further code.
My Batch class evokes a trigger on a object, which tries to upsert some related object on it, but in fact there is simply no need and because an issue with that upsert my rest of the code hangs up.
Is there a way to avoid it....i have tried to put the upsert in try catch block, but it doesnt help....
try{
upsert x;
}catch(exception e){}
Please help....
Thanks,
Maverick
Have a static boolean sitting somewhere in another class
public static boolean isBypass = false;
----------------
In your batch do
ClassName.isBypass = true;
---------------
In your trigger, have your first line be something like:
if (ClassName.isBypass)
return;