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

How To Bypass Automations & Validations in Salesforce for Mass DML Operations
by: asagarwal
blow post content copied from  Ashish Agarwal – Independent Architect & Blogger
click here to view original post

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 data load process it may also lead undesired processing like triggering emails to internal and external users, sending interface message to backend systems and lead to process and/or data inconsistency 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 OperationsOr 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 a hierarchical custom setting to bypass validations and automations built using different features of Salesforce. 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.

To download a PDF copy of the presentation above

check to receive weekly updates on more of such awesome guides

(You'll never be spammed on my watch. And that's a promise)

References & Useful URLs:

The post How To Bypass Automations & Validations in Salesforce for Mass DML Operations appeared first on Ashish Agarwal - Independent Architect & Blogger.

November 02, 2021 at 03:30AM
Click here for more details...

The original post is available in Ashish Agarwal – Independent Architect & Blogger by asagarwal
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.