Salesforce Bypass Best Practice

    The purpose of this article is to review examples of bypass within your Implementation of Salesforce. There are many ways to set up bypass and all admins/consultants have their own or preferred method. We recommend creating custom checkboxes on the Users object, and then relating them to all workflow, validation rules, triggers, Process Builder, etc...

    Creating the Checkbox Fields

    In this example, we will create three checkbox fields, one for Bypass Validation Rules, one for Workflow, and one for Process Builder.

    We recommend making the fields Read Only for all profiles except the system administrator.

    So, you should have something like this in your User Object metadata:

    Creating the Validation Rules

    The next step is to add a relevant condition to the checkbox. Note that the rule must be FALSE 

    Validation Rules Example

    For example, for a validation rule that states a Lead Status cannot be "Qualified" if the Phone number is empty, it should look something like this:

    You must add a condition to the rule that the checkbox of the user that will populate this rule, must be false.

    Before a restore (or for any reason), if you want a specific user to bypass the validation rules (and all

    other processes), just navigate to the user and select the checkbox.

    Workflow Example

    Process Builder (Criteria Level) Example

     

    Process Builder (Node – No Action) Example

    In this example, it is assumed you already have existing processes with dozens of criteria nodes. Reviewing each node and inserting the “ByPass code” (reviewed in the last example) could be challenging and time-consuming. In this case, we recommend creating a new criteria node that we will place in the first position, if it meets the criteria, “bypass = true”, then it will stop the process.

    Currently, there is a Salesforce limitation where we have to add an action to a criteria node. To overwrite this, we create an action that will do “nothing”.

    First, create an Apex Class:

    Then a Test method for that class:

    Navigate to your Process Builder, which is now editable and create a new Criteria Node as follows: (we still have a bypass based on the checkbox on the User Object)

    Finally, add the DoNothing Action to that Node:

    The result should be as follows:

     

     

     

     

     

    « Previous ArticleNext Article »