3

I am attempting to deactivate a trigger in production. I deactivated it in a sandbox, but when I attempted to deploy I got an error in an unrelated class and was unable to deploy. My guess is that somebody has changed something directly in production, causing the error in the class. It must be that because I successfully deployed something a couple of weeks ago and nothing had changed in the trigger code.

So now I'm basically stuck. I can't deactivate anything because I just get errors.

Does anybody know of a workaround which would get me past all of this ? My thought was to comment-out the entire class temporarily just long enough to deactivate the triggers I want to get rid of, but that didn't work either.

Thank you for any input.

5

Best practice to disable a trigger is to modify the associated metadata in the .xml file when you retrieve the file from the server into your IDE.

The code inside should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>28.0</apiVersion>
    <status>Active</status>
</ApexTrigger>

You can set the status to Inactive (only supported for triggers and not classes) and deploy the .xml file

  • Thank you very much for your input. Yes, I have attempted that same method through Eclipse. However, I cannot successfully deploy anything to Production because of the error I am receiving from the (unrelated) class which is already in Production. I apparently need to find a way to make that class which is error-ing out inactive in order to make the trigger inactive. The trigger is working properly. I was hoping to find some kind of back-door way of doing that. Any other suggestions would be greatly appreciated. Thank you. – Zoom_v Aug 20 '13 at 14:12
0

There are 5 ways to deactivate trigger from Production

  • Deactivate trigger
  • Comment Code
  • Use custom settings
  • Using Eclipse IDE
  • Using ANT tool

There are 3 ways to remove an Apex class from Production.

  • Using Eclipse IDE
  • Using ANT tool
  • Comment Code

I've consolidated the list.

More on this here https://sfdcfanboy.com/2017/11/23/a-tip-a-day-23-5-ways-to-stop-trigger-in-production/

https://sfdcfanboy.com/2017/11/24/a-tip-a-day-24-3-ways-to-delete-an-apex-class-from-production/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.