DATA MIGRATION & FLOW TUTORIALS

Search

Turn Off Salesforce Automation with an Easy Switch

Salesforce          Data Loading          How-to

July 19, 2022

Email
Facebook
LinkedIn

Are you a system administrator who needs to easily switch off automation for only you so that you can run data loads during business hours?

Create a custom field on the user object called “Deactivate Automation.”

Path: Setup – Object Manager – User – Fields & Relationships – New – Checkbox field type – name it Deactivate Automation”

Turn Off Salesforce Automation with an Easy Switch


Ignore Validation Rules

To bypass validation rules during data loads, do a one-time modification of each rule to add a line of logic that says:

$User.Deactivate_Automation__c = FALSE

What this means is that the rule will continue to fire for everyone EXCEPT users whose “Deactivate Automation” box is checked (i.e. TRUE).

Here’s an account validation rule that is saying “every account record has to have the Billing Street populated.”

Account Validation Rule

Once I edit the rule to add the additional line of logic, it looks like this:

Account

I clicked the Insert Field button, selected User, selected Deactivate Automation” and clicked the Insert button. Close and save.

When the checkbox on my user record is NOT checked, the validation rule works as expected.

TEST: I edited an account record and tried to save it without populating the Billing Street and got the validation rule error.

When I check the “Deactivate Automation” box on my user record, the validation rule will not fire.

TEST: I edited an account record and then saved it without adding a Billing Street, and did not see get validation rule error.

If/when I am ready to have the validation rules apply to my user record again, I will uncheck the Deactivate Automation box on my user record.

CONCLUSION: Once I add this logic to my org’s active validation rules, I can load data without being impacted by validation rules.

 

Ignore Process Builders

To load data and prevent all process builders from running, I will add a line of logic to each.

* This is for the consultants who are running data loads in client orgs who have active Process Builders. It’s common for consultants to be hired for specific things and not have time allocated in the SOW to build flows to replace PBs.

** If you’re a system admin and haven’t replaced your PBs with Flows yet, tsk tsk tsk.

***Honestly, it may take less time to just create new flows to replace PBs if you want to use this functionality because all of your PBs using criteria need to be edited to become formulas in order to access the user field.

Edit each process builder, change th and add a similar line of logic to the one you added to your validation rules.

In this example, my PB changes the “Account Status” picklist field to “Client” when the Opportunity Stage = Closed Won.

But now, I need to change the criteria to “Formula evaluates to true” to access my user field.

Here is what I typed into the formula builder:

$User.Deactivate_Automation__c = FALSE
&&
ISPICKVAL([Opportunity].StageName ,”Closed Won”)

This is saying “If the user’s Deactivate Automation field is NOT checked AND the opportunity stage changes to Closed Won”, then run the action.

Ignore Flows

I’m sure you’re seeing a pattern here – now we need to add some logic to our flows. (Hopefully you didn’t have any active PBs to mess with so you skipped that section anyway.)

I add a decision to the flow so that the flow only runs if the Automation is on.

Here’s what the decision looks like for the automation “Off” position.

Turn Off Salesforce Automation

Here’s what the decision looks like for the automation “On” position.

Turn Off Salesforce Automation

Here’s a picture of the whole flow (same test scenario as the PB in the previous section.)

Turn Off Salesforce Automation


Conclusion

 

Search

Table of Contents

Woman with orange fingernails subscribing to Salesforce tutorials
Don't miss out!

weekly tutorials

I’ll send you a new Salesforce tutorial every week, because that’s just the kind of gal I am.