I had to deactivate a Trigger in Production recently and had a darn difficult time doing so!
At first, I tried to just make it Inactive. I did this by opening the metadata file within Eclipse, and chaning
Inactive. However, my change could not be saved to the server because of a Test that failed. I think it was a test for the Trigger, which was no longer active! In the end, things got so confused that I decided just to delete the Trigger rather than deactivating it. (This would also be less confusing for other people to support, since it might not be obvious that a Trigger is inactive.)
I then tried to delete the Trigger in Production via the Setup screen (normal Salesforce UI). However, in Production, the Del option is not displayed.
Triggers in Production — no option to delete
So, I went into my sandbox (where I do my Trigger development) and deleted the Trigger from there. I also deleted by TestMethod that tests the Trigger.
Triggers in the Sandbox — a Delete option at last!
Finally, I went into Eclipse and did a Refresh from Server. This made the files disappear within Eclipse.
I then deployed to Production, ticking Delete next to the files in my Deployment Plan. (For safety, I always Deselect All when deploying, then sort by Type. Only then do I tick which files to deploy, since choosing the wrong ones could cripple Production.)
The Bottom Line
- It’s more obvious to delete Triggers than deactivate them
- Deleting Triggers from Production isn’t straight-forward
- Delete them from Development/Sandbox first, then deploy the change to Production