Ways to Bypass Salesforce Flow for a User or Profile

When we create a flow, we specify entry criteria for when that flow should execute, and when those criteria are met, the flow executes and does the automation. However, due to business requirements, we may need to bypass the flow automation logic for specific users/profiles for a period of time.

💼 Business Use Case

On the Opportunity object, a custom field (LastModifiedDate_Custom__c) is created, and it should be updated whenever the user makes any changes to the opportunity record. As part of data fixes, a data loader or system administrator user usually updates hundreds of opportunity records per day.

  • Business users do not want these fields to be updated when system administrators or data load users update the field.
  • Sometimes we encounter bulk operations issues such as the maximum time limit being exceeded due to multiple flows or automation tools being active and running at the same time for bulk records, it is decided to implement the functionality to bypass the flows for any user at any time. The solution should be flexible and adaptive.

The custom field update is just an example; there may be other use cases where the business will ask you to bypass the flow, or you may need to bypass the flow for users for a specific time period for technical reasons.

🙋‍♂️ How can we bypass the flow ❓

The three approaches to bypassing the flow are listed below.

💡 Solution Approach #1

↠ Bypass the flow on the user level.

Create a field on the user object.

  • Field Label: Bypass Flows
  • Data Type: Picklist (Multi-Select)
  • Enter values, with each value separated by a new line.
Advertisements

As you can see, I’ve included all of the Flow labels/names in this field value. I can bypass any or all of the flows for a specific user.

  • Click Next and Next.
  • Add this field to User page layouts
  • Click on the Save button.

⚙️ Configure Flow Start Element

Now open the flow start element page and select the ‘Formula Evaluates to True’ value in the Condition Requirements picklist field.

Note: You must include the formula condition shown below in the entry conditions along with your other conditions for each flow to be bypassed.

Next, added a flow assignment element to assign today’s date time in the LastModifiedDate_Custom__c field. The ‘todayDateTime‘ is a formula variable used NOW() function to get the current date/time.

This is what the flow will look like.

Advertisements

Check your flow it should work as expected for all the users.

Now, To bypass the flow for a user, go to the user detail page and select the flow name you want to bypass in Bypass Flows multi-select picklist field and click on Save. Your flow will no longer run for this user after you update this field.

💡 Solution Approach #2

↠ Bypass the flow on the Profile/PermissionSet level.

In this solution approach, we will use Custom Permission to solve this. Custom permissions can be used to grant users access to custom processes or apps.

Custom permissions allow you to define access checks that can be assigned to users via permission sets or profiles in the same way that user permissions and other access settings are assigned. For example, in our flow, we are going to define access checks that the flow should not execute who have custom permission.

Below are the steps:

⒈ Create a Custom Permission in your org.

  1. Click Setup.
  2. In the Quick Find box, type Custom Permissions.
  3. Click on the New button.
  4. Enter Label the Name will auto-populate. 
  5. Click Save.

⒉ Assign Custom Permission to DataLoader User Profile / System Administrator Profile

  1. Goto Setup.
  2. Search Profiles in the quick find box.
  3. Navigate to Apps | Custom Permission and click on the Edit button.
  4. Assing the Bypass Flow Custom Permission to the profile.
  5. Click on the Save button.

Modify the Entry Criteria in the Flow

  1. Open your flow in the flow builder.
  2. Click on Start Element, then Edit.
  3. In the entry condition formula, enter the following condition along with your other conditions and press the save button.
NOT ( {!$Permission.Bypass_Flow} )

Done and dusted. Now, whenever you need to bypass the flow, simply assign the custom permission to the profile, and the flow will not execute for the users in that profile.

💡 Solution Approach #3

↠ Bypass the flow on the Profile level.

This is an easy and simple way to bypass the flow by checking the name of the profile in the entry condition OR in any decision element.

  1. Open your flow in the flow builder.
  2. Click on Start Element, then Edit.
  3. In the entry condition formula, enter the following condition along with your other conditions and press the save button.
 ( {!$Profile.Name} != 'System Administrator' && {!$Profile.Name} != 'Data Load User' ) 
Advertisements

📃 Summary

You may receive a request from the business to bypass the flow for specific users or profiles so we learned three different ways to bypass the flow for users and profiles. We also learned about Custom Permission and how it can be used to define access checks.

  • If you need to bypass the flow at the user level, use Solution Approaches #1 OR #2 with permissions set.
  • If you need to bypass the flow on the profile level, you can use Solution approach #2 with profile OR Solution approach #3.

Join 768 other followers

Advertisements
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s