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

8 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….

  4. jonas bosson Says:

    I did the same steps. First I deleted the trigger (and test) in sandbox on the web, but now I cant find any delete rows in the deployment plan that I get from selecting “Deploy to Server” in eclipse.

    Am I looking at the wrong place?

  5. The Enforcer Says:

    Jonas, you’ll need to delete them in Eclipse, then Deploy to Server.

    If you’ve deleted them from the web, you might need to Synchronize again to have them disappear from Eclipse.

  6. jonas bosson Says:

    Tanks alot! That did it.

  7. Bill Sloane Says:

    Most import step in the whole delete process is you need to right-click on the FOLDER and deploy to server.
    1-delete trigger in eclipse
    2-right-click on triggers folder and deploy to server
    3-this should bring up a list of triggers to add/delete/overwrite
    4-select delete.

  8. Dan Says:

    Big help. Cheers mate