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
Olivera MilevskaOlivera Milevska 

I need to deactivate an apex trigger in production

The apex trigger was created a few years back and it currently updates the contact owner when the account owner is updated. It is no longer valid. Can I have some steps to action please? 
ManojjenaManojjena
Hi Olivera Milevska,
You can deactivate the trigger in sandbox and deploy the trigger to production .
One thing you need to keep in mind the inactive trigger will reduce code coverage percent, If you want to delete teh trigger then you can delete

Check below links to delete trigger from production.

https://help.salesforce.com/articleView?id=000003942&type=1

https://developer.salesforce.com/forums/?id=906F0000000AuOLIA0


Let me know if it helps !!
Thanks
Manoj
buggs sfdcbuggs sfdc
hey olivera,

step 1:--
First try to deactivate the same trigger in sandbox.
step 2:--
make a changeset of the deactivated trigger it and push into production org.
 
Note :-- You cannot deactivate the triggers directly in prodcution org
syeda syedasyeda syeda
Hi Olivera,

            we can stop/deactivate the trigger in live aslo. But before this you need to write a system label and also you need to write if condition in trigger related to system label if it is true/false and then you can deactivate trigger in live with this condition , please let me know if it would be helpful to you

Thanks
 syeda
Amit Chaudhary 8Amit Chaudhary 8
Turn off trigger in production org (https://help.salesforce.com/articleView?id=000005417&type=1)
  • Disable the trigger in sandbox environment [You should have a sandbox org which contains the same trigger]
  • Create a new project in Eclipse using the Sandbox and including the trigger (or refresh your existing Eclipse project)
    • 1. Alternative: edit the triggername.trigger-meta.xml in an existing project and change the status node to false: <status>Inactive</status>
    • 2. Save the change locally Deploy the trigger to production
  • Complete the data load
  • 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

Check below post as well for more information
1) https://success.salesforce.com/answers?id=90630000000DDLZAA4

Let us know if this will help you
 
sfdcFanBoysfdcFanBoy
Yes, there are a number of ways to do it.  I have consolidated the list. 

5 Ways to Deactivate a Trigger in Production (https://sfdcfanboy.com/2017/11/23/a-tip-a-day-23-5-ways-to-stop-trigger-in-production/)
3 Ways to Delete an Apex class from Production (https://sfdcfanboy.com/2017/11/24/a-tip-a-day-24-3-ways-to-delete-an-apex-class-from-production/)