- Salesforce Development Posts of a Fashion by Matt Lacey

Back to Posts

Quickly Deactivate Triggers in Prod

Ok, the title is a bit of a lie, this won't enable you to de-activate a prod trigger right this very moment, but it does describe how you can make this much faster to do in the future, and it's all pretty simple.

Step 1

Deploy a change set from your Sandbox to Production, with the trigger deactivated.

Well duh, you probably guessed that much.

Step 2

Deploy a change set from your sandbox to Production, with the trigger activated.

Step 3: Profit (In the Future)

Next time you need to disable, or enable, the trigger in question, you simply have to visit "Inbound Change Sets" in your production org, and deploy the corresponding one, they'll both be sitting there ready to go again. Of course, you want to be sure the trigger hasn't changed in the mean time or you could be overwriting something, but then if you're following best practices your trigger is probably a one-liner with the logic elsewhere. Sure, you have to be careful with this, and it's not as good as actually putting settings in your triggers that can be toggled from elsewhere, but in a pinch it can be handy, and doesn't require any code if you don't have such things in place.