How To Bypass Automations & Validations in Salesforce for Mass DML Operations

In Salesforce, it is not uncommon to mass insert, update or delete records from time to time. This may be required to onboard new business units, departments or applications, fix bugs, patch existing records with certain values, accommodate changes in data model, archive and delete data etc.

But as we process data in bulk, validation rules and automation that are defined in Salesforce kicks in. This not only slows down the DML operation but may also lead to undesired processing like triggering emails to internal and external users, sending interface messages to backend systems and cause process and/or data integrity issues.

One of the ways around this problem is to deactivate these automations and validations, run your mass DML operations and reactivate. However, the challenge with this approach is that first it will require a downtime for your users and second it will take time and effort to deactivate and reactivate. This approach may be okay if these mass DML operations are not frequent, the number of validations and automations are not high, and your business does not mind a downtime. 

Bypass Automation & Validations in Salesforce for mass DML Operations

Or the second option will be to bake in some kind of mechanism in your solution to not to run these automations & validations for mass DML operations. Something like diverting heavy vehicles to take another route.

And this is where we can use “Custom Setting” of “Hierarchical” type in  Salesforce The benefit of using custom setting of hierarchal type is that you can define it at the org level and then override it at the profile level or user level. So for the scenario mentioned above, we can use a custom setting to bypass the validations and automations for a particular user and then use that user to perform mass DML operations.

In this step-by-step guide we will explore how to use the hierarchy custom setting to bypass validations and automations without impacting the normal operations. Like how to bypass. Like how to bypass:

  1. Validation Rules
  2. Workflow Rules
  3. Process Builder
  4. Salesforce Flows
  5. Apex Triggers

So, let’s grab a cup of coffee and dive in.

References & Useful URLs

4 thoughts on “How To Bypass Automations & Validations in Salesforce for Mass DML Operations”

  1. This is a very useful guide on how to implement a bypass for flows. Extremely valuable when you do data imports!

    Thank you Ashish!

  2. Javeria Chaudhry

    On Slide 24, onmy end, Location field is greyed out. I tried to google the reason but most posts were about greyed out List option instead of Hierarchy. Do you have a wild guess why Location is greyed out?

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top