Our latest “Salesforce Tip of the Week” is dedicated toward anyone who lives on the technical side of Salesforce. Chris Bland, LevelEleven’s Director of Engineering, has just the wisdom to keep your days happy: Use custom settings to disable triggers. Watch this quick video for details…
Or, check out the transcript:
Save the Hassle: Disable Triggers
I’m Chris Bland, Director of Engineering at LevelEleven.
I use Salesforce every day to develop our AppExchange app. In addition, I also develop our custom application for our sales team, as well as our customer support reps.
My “Salesforce Tip of the Week” is to use custom settings to help disable triggers when something goes wrong.
If you’re an admin and you’ve had a deployment go wrong — where a trigger slips in and maybe there’s an error in a line of code you didn’t catch and all of a sudden all of your users are locked out of saving or updating any records — right now, you’re panicking. So, what do you do? You find the piece of code that’s wrong, you fix it, but now you have 20 to 30 minutes to wait for large orgs for the deployment to go through.
So what can you do about this? You can use custom settings along with triggers to ensure that if this ever happens to you, you can disable your triggers with a simple custom setting.
To do this, create a new custom setting. Call it a check box. Set the type to check box — make sure it’s disabled. Then, in your trigger, write a simple method to return if the trigger should be firing. If the triggers are disabled in a situation where you’ve had a bad deployment, you can simply disable them, write your code, fix it in deployment, deploy it again. All your users are none the wiser, and you’ve now saved yourself some time and hassle.
Have a Salesforce tip you’d like to share? Click here.