+ Start a Discussion
KMK91KMK91 

Is it possible to deactivate trigger in production and How?

Best Answer chosen by KMK91
Amit Chaudhary 8Amit Chaudhary 8
Hi [Madhukar k] Madhukar k,

There are two way to deactivate the Trigger directly in prod
1) Create custom setting to activate or deactivate trigger (Best One)
https://www.sundoginteractive.com/blog/disabling-triggers-in-production-dynamically
http://www.salesforcegeneral.com/salesforce-articles/salesforce-bypass-rules-and-triggers.html
2) You can also do the same by eclipes. Please check below post
https://help.salesforce.com/apex/HTViewSolution?id=000005417&language=en_US (https://help.salesforce.com/apex/HTViewSolution?id=000005417&language=en_US)

Important: You must consider the consequences of disabling a trigger in the production environment during work hours. It is highly recommended to perform this work outside normal business hours and to disable access to the application to non administrators during the maintenance period.

Follow these steps:
1) Disable the trigger on the sandbox environment
2) Create a new project in Eclipse using the Sandbox and including the trigger (or refresh your existing Eclipse project)
3) Alternative: edit the triggername.trigger-meta.xml in an existing project and change the status node to false: <status>Inactive</status>
4) Save the change locally
5) Deploy the trigger to production
6) Complete the data load
7) If the change is not permanent or you want to enable the trigger again then enable the trigger by making it active on the sandbox or project again and deploy it to production

Please let us know if this will help you

All Answers

sharathchandra thukkanisharathchandra thukkani
Yes it is possible without deploying your inactive trigger, You can create custom settings where you have checkbox field which you will refer in your trigger and modify that record value to make it active or inactive
karunakarreddy bade 8karunakarreddy bade 8
hi 


I think this documentation is worth reading through for a better understanding
(https://help.salesforce.com/apex/HTViewSolution?id=000005417&language=en_US)


Thanks
B.karunakar
 
Amit Chaudhary 8Amit Chaudhary 8
Hi [Madhukar k] Madhukar k,

There are two way to deactivate the Trigger directly in prod
1) Create custom setting to activate or deactivate trigger (Best One)
https://www.sundoginteractive.com/blog/disabling-triggers-in-production-dynamically
http://www.salesforcegeneral.com/salesforce-articles/salesforce-bypass-rules-and-triggers.html
2) You can also do the same by eclipes. Please check below post
https://help.salesforce.com/apex/HTViewSolution?id=000005417&language=en_US (https://help.salesforce.com/apex/HTViewSolution?id=000005417&language=en_US)

Important: You must consider the consequences of disabling a trigger in the production environment during work hours. It is highly recommended to perform this work outside normal business hours and to disable access to the application to non administrators during the maintenance period.

Follow these steps:
1) Disable the trigger on the sandbox environment
2) Create a new project in Eclipse using the Sandbox and including the trigger (or refresh your existing Eclipse project)
3) Alternative: edit the triggername.trigger-meta.xml in an existing project and change the status node to false: <status>Inactive</status>
4) Save the change locally
5) Deploy the trigger to production
6) Complete the data load
7) If the change is not permanent or you want to enable the trigger again then enable the trigger by making it active on the sandbox or project again and deploy it to production

Please let us know if this will help you
This was selected as the best answer
WorkaholicWorkaholic
Why these questions are getting posted in job posts.Post them in general development
sfdcFanBoysfdcFanBoy
There are a number of ways to stop a trigger to run.  I've consolidated the list.  Read here

https://sfdcfanboy.com/2017/11/23/a-tip-a-day-23-5-ways-to-stop-trigger-in-production/
Ishaq RamzanIshaq Ramzan
Visualforce is GA in Lightning Experience with the Summer '16 release! Join us to learn how to implement business logic with interactive UI by coupling Visualforce and Lightning Components. As well as best practicesfor enabling your Visualforce pages in Lighting Experience....... (https://statuskudi.blogspot.com/2022/04/urdu-sad-shayari.html?m=1)