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
Shivani Thakur 32Shivani Thakur 32 

Create a Hierarchical custom setting “Trigger Setting”. Create fields for all triggers developed in your system. This custom setting should be used to enable/disable any trigger from your org.

Best Answer chosen by Shivani Thakur 32
SwethaSwetha (Salesforce Developers) 
HI Shivani,
Create a custom setting (say Trigger_Settings__c).  Add a checkbox field “Is Active”.  So your custom settings will store the trigger name and its status in IsActive checkbox.
Then in your apex trigger, add an IF condition at the top to check if the Trigger status in Custom settings is TRUE, only then run the entire apex trigger code.
trigger oppTrigger on opportunity (before insert){
  Trigger_Settings__c TS = Trigger_Settings__c.getValues('oppTrigger');
  if(TS.is_Active__c == TRUE){
    //your trigger code
  }
}
So, every time you want to turn off the trigger in production, just go to your custom settings and uncheck the IsActive checkbox for that trigger

Reference:https://sfdcfanboy.com/2017/11/23/a-tip-a-day-23-5-ways-to-stop-trigger-in-production/#

Also see https://salesforce.stackexchange.com/questions/166252/activate-and-deactivate-trigger-using-custom-setting
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful.Thank you

All Answers

SwethaSwetha (Salesforce Developers) 
HI Shivani,
Create a custom setting (say Trigger_Settings__c).  Add a checkbox field “Is Active”.  So your custom settings will store the trigger name and its status in IsActive checkbox.
Then in your apex trigger, add an IF condition at the top to check if the Trigger status in Custom settings is TRUE, only then run the entire apex trigger code.
trigger oppTrigger on opportunity (before insert){
  Trigger_Settings__c TS = Trigger_Settings__c.getValues('oppTrigger');
  if(TS.is_Active__c == TRUE){
    //your trigger code
  }
}
So, every time you want to turn off the trigger in production, just go to your custom settings and uncheck the IsActive checkbox for that trigger

Reference:https://sfdcfanboy.com/2017/11/23/a-tip-a-day-23-5-ways-to-stop-trigger-in-production/#

Also see https://salesforce.stackexchange.com/questions/166252/activate-and-deactivate-trigger-using-custom-setting
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful.Thank you
This was selected as the best answer
Shivani Thakur 32Shivani Thakur 32
yes, i can try this. Thank you!!!