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
James East 5James East 5 

Disable Multiple Apex triggers

Hi all

Is there a simple way to add in a few lines of code to existing Apex triggers to prevent them running rather than having to go into all 45 of them when Im performing various admin tasks.

The triggers when executed send various emails to internal and external customers and amend or create records that I would usually disable before starting my tasks.

Can code be added to reference a value in a table or selected drop down that then allows or disallows the remainder of the code to be ran

thanks in advance
James
Brian Cherry FWIBrian Cherry FWI
You could add in a line in the apex trigger like so:
currentuser = UserInfo.getUserId();
if (currentuser != 'YourIDHere')

Your trigger actions
}
else
 {

}
 
JeffreyStevensJeffreyStevens
You could also create a custom setting, with a boolean field like "Disable triggers". Then all of your trigger code could go and check that custom setting, and skip everything from running if needed.