AddThis Feed Button

Recent Items

Tags: Apex

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 Active to 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

3 Responses to “How to delete Triggers in Production”

  1. Johan Liljegren Says:

    I believe there is a simpler way.
    Highlight the trigger in the IDE and hit DEL. It will ask you if you want to delete it on the server or locally only.

    I have to admit I haven’t tried this in a couple of months, but it used to work this way.

  2. Gary Triassi Says:

    This information was VERY helpful. The process should be documented better in the IDE reference material (they should just steal what you’ve written:-)!). I sincerely appreciate you taking the time to post this.

    Best regards,

    Gary Triassi | Managing Principal | Trigon Group

  3. britishboyindc Says:

    Thanks for this – this was proving to be much more difficult than it needed to on a Sunday night!.
    For anyone else trying to do this, I ended up having to create a new project in Eclipse based on the updated sandbox with the triggers deleted, and then deploying that project to Prod..at that point, the triggers were available for deletion….

Leave a Reply