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
Ankur SrivastavaAnkur Srivastava 

Activating triggers & validation rules programatically

What is the most effective way to activate or inactivate the triggers or validation rules of an sObject programmatically ?
Best Answer chosen by Ankur Srivastava
vmanumachu1.393650924860069E12vmanumachu1.393650924860069E12
I dont think there is API to disable/enable triggers. Having said that, you can use a boolean field on a sObject to which you can use to decide whether to execute the logic in the trigger. Something like:

if(boolean__c == true)
{
//do something
}

You have to bascially set the boolean to either true or false based on your requirements. You can use custom settings as well.

Please mark it as best answer if this answers your question. It helps others.