Creating an On-off Power Switch for All Org Automations

Share this article...

Data imports play an important part in Salesforce administration, however, we may run into issues when importing as it kicks off automations. Automations like Flows, Workflow Rules, Triggers and Validation Rules that could be applied automatically when you import data into Salesforce. Most of the time that’s fine, but sometimes you just want to import data without any interventions – or avoid any data import failures because it doesn’t meet the criteria in your automations.

Wouldn’t it be great to have a power switch to turn automations on and off with just one click? In this post I’m going to show you how you can do exactly that, making future imports a breeze!

Step 1: Custom Settings

The first step is to go to Setup > Custom Settings. This is where we will do our magic and create a new Custom Setting:

  • Click New
  • Label: ‘Automation Settings’
  • Object Name: ‘Automation_Settings’
  • Click Save

Next we create some Custom Fields, based on which automations you want to control with the On/off switch. In this example I’ll create one for Validation Rules:

  • Click New
  • Select Checkbox
  • Field Label: ‘Validation Rules Enabled’
  • Default Value: Checked
  • Field Name: ‘Validation_Rules_Enabled’
  • Click Next
  • Click Save

Repeat this for each automation, like Workflow Rules. The result should look like this:

Image 1: Custom Setting created with two Custom Fields

Step 2: Reference Custom Settings

With the checkboxes in place, it’s now time to reference them in our automations. This means that when a checkbox in Custom Settings is checked it will execute the automation, if it’s not checked, it won’t execute the automation.

So if you have 12 Workflow Rules, add an entry to the Rule Criteria in all 12 workflows. That should look like this:

‘$Setup.Automation_Settings__c.Workflows_Enabled__c && … ‘.

Image 2: reference to Custom Setting added to the Workflow Rule Criteria

Result: when the ‘Workflows Enabled’ checkbox is checked in Custom Settings, the workflow will be executed, if not the workflow will not be executed.

Let’s do the same trick for Validation Rules. Add $Setup.Automation_Settings__c.Validation_Rules_Enabled__c && to the Error Condition Formula of each Validation Rule:

Image 3: reference to Custom Setting added to the Error Condition Formula of the Validation Rule

Result: when the ‘Validation Rules Enabled’ checkbox is checked in Custom Settings, the Validation Rule might return TRUE, if not the Validation Rule will never return TRUE.

These are two examples of how you can control automations. But remember, it can also be applied to Flows, Triggers and Process Builders.

Step 3: Turning The Switch

The final step is to learn how to use the switch. Let’s go back to the checkboxes we created earlier:

  • Go to Setup > Custom Settings
  • Click Manage
  • Click Edit
  • Turn checkboxes on or off
  • Click Save
Image 4: turning checkboxes on or off

Result: now you have full control of which automations will or will not run when you import data in your org.

Final Tips

The On-Off switch is a very powerful tool and can be risky so consider this advice before implementing:

  • Be disciplined in referencing the Custom Setting in all automations you want to control.
  • Going forward, always add the Custom Setting to any new automations.
  • Automations are an essential part of Salesorce; don’t forget to turn them back on as soon as the data import is done!

8 thoughts on “Creating an On-off Power Switch for All Org Automations

  1. This is great, but since you can’t save a process builder without an action, it would be nice to see complete setup. I have no idea what to do next. I mean, I guess I could send an email to myself reminding me to turn the automation back on?

    1. Christine Marshall


      Hi Sam,

      I’m not 100% sure what you’re asking here? Perhaps you could rephrase the question so we can see if we can help?

      Thanks, Christine

        1. Christine Marshall


          Thanks for the feedback Sam. We’ll take that onboard and see if we can update the post in future to include Process Builder.

        2. Saicharan Reddy Kasireddy


          Hello Sam,

          You can invoke a dummy Apex class with an invocable method that has nothing.

          public class ProcessBuilderDoNothing {
          public static void DoNothing() {}


Add Comment