You can run into issues when importing data into Salesforce, as this kicks off automations such as Flows, Triggers and Validation Rules. 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 guide I’m going to show you how you can do exactly that, taking advantage of custom settings.
*Disclaimer: Creating an On/Off Power Switch is incredibly powerful and can have unintended consequences, for example, importing poor quality data. Automations and data validations are there for a reason. Before you import any data, you should ensure that it is thoroughly cleansed and suitable for import.
Step 1: Custom Settings
Go to Salesforce Setup → Custom Settings. Create a new custom setting:
- Label: ‘Automation Settings’.
- Object name: ‘Automation_Settings’.
Next, create 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, and select checkbox.
- Field label: ‘Validation Rules Enabled’.
- Default value: Checked.
- Field name: ‘Validation_Rules_Enabled’.
- Click next, and save.
Repeat this for each automation (e.g. Flow) and the result should look like this:
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 the custom settings is checked, it will execute the automation – if it’s not checked, it won’t execute.
So if you have 12 Flows, add an entry to the resource in all 12. That should look like this:
‘$Setup.Automation_Settings__c.Flow_Enabled__c ‘ followed by whichever other criteria is needed.
Result: when the ‘Flow Enabled’ checkbox is checked in the custom settings, the Flows will be executed – if not, the Flows will not be executed. Within the Flow, you can find the Custom Settings fields under the Setup global variable.
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:
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.
Read More : https://www.salesforceben.com/custom-settings-in-salesforce-flows/
Step 3: Turning On The Switch
The final step is to learn how to use the switch. Let’s return to the checkboxes we created earlier:
- Go to Setup → Custom Settings. Click manage, then new or edit.
- Check/uncheck the checkboxes (on or off), then click save.

Final Tips
Now, you have full control of which automations will/won’t execute when you import data in your org.
While the on-off switch is powerful, it can be risky. So, consider this advice:
- Be disciplined in referencing the custom setting in all automations you want to control.
- Automations are an essential part of Salesforce – don’t forget to turn them back on as soon as the data import is complete!
Comments: