Bypass Salesforce Flow for a Specific User or Profile

Advertisements

Last Updated on April 6, 2022 by Rakesh Gupta

Big Idea or Enduring Question:

  • How can you bypass a Salesforce Flow for a specific user or profile? 

Until now, we have created many flows using Salesforce Flow. It is an easy and fun experience to create flows. These flows will execute as soon as they meet the criteria. There are some situations, however, when a business may want to bypass a flow!

Prerequisite

 Please go through this article first and make sure to create it:

  1. Getting Started with Salesforce Flow – Part 108 (Working with Polymorphic Relationship in Salesforce Flow)

Objectives:

After reading this blog, you’ll be able to: 

  • Understand how to create a custom permission
  • Understand how to clone an existing flow 
  • Understand how to use custom permission to bypass flows 

Business Use Case

Melissa Howard is working as a System Administrator at Gurukul on Cloud (GoC). She has developed a Flow (Working with Polymorphic Relationship in Salesforce Flow) to auto-close a case when a task with the subject – Case follow-up is successfully completed – and it is related to the Case object. 

Melissa has now received a requirement to bypass this flow for the system administrator. A system administrator usually updates hundreds of tasks every week. And therefore, business users want to avoid updating the case status closed. 

Automation Champion Approach (I-do):

It is easy to bypass a Flow for a single user or a profile – in this case, a system administrator – by adding a condition in your flow, as shown in the following screenshot:

But what happens, if the business comes back after a few weeks and requests Pamela to bypass a Flow for one more profile and one more user (belonging to a different profile). If this happens, it would create a headache for Pamela – how many times is she going to modify a flow to bypass it for different profiles or users?

As if this was not bad enough, let us suppose that after a few months again, Pamela gets yet another requirement to bypass the flow for a few more users who belong to different profiles – What a nightmare! Let us bypass this scary scenario itself! And, let us learn how to use custom permission with Salesforce Flow

Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes going through the following Flow diagram and understand it.

Let’s begin building this automation process.

Guided Practice (We-do):

There are 3 steps to solve Melissa’s business requirement using Record-Triggered Flow. We must:

  1. Creating a custom permission
  2. Assign custom permission to the system administrator profile  
  3. Salesforce Flow
    1. Clone existing flow
    2. Modify decision element criteria

Step 1: Creating a Custom Permission 

By using custom permissions, you can grant users access to custom apps. In Salesforce, you can use custom permissions to check which users can access certain functionality. Custom permissions let you define access checks that can be assigned to users via permission sets or profiles – similar to how you assign user permissions and other access settings. You can even use custom permission to bypass the validation rule for certain users or profiles. Let us create custom permission to bypass flows. 

  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.

Step 2: Assign Custom Permission to the System Administrator Profile 

  1. Click Setup.
  2. In the Quick Find box, type Profiles.
  3. Open the System Administrator profile. 
  4. Then navigate to Apps | Custom Permission and click on the Edit button.
  5. Now, assign the Skip Salesforce Flow custom permission to the profile.
  6. Click Save.

Step 3.1: Clone Existing Flow 

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the Flow Name that will be modified. In this case Update Case on Task Completion.
  4. Click on the Save As button at the top right of the Flow builder.
  5. Click Save.

Step 3.2: Modify Decision Element Criteria

Now you can modify the record-triggered as per the business requirement. We will add one condition to our flow to check whether the user has access to Skip salesforce flow custom permission or not. 

  1. On Flow Designer, modify the Task Related to Case Decision element.
  2. Add another criterion to check custom permission. Now click on the System Variable dialog, It will open a popup where you have to select Permission and then select custom permission Skip salesforce flow.
    1. Click Add Condition
    2. Row5:
      1. Resource: {!$Permission.Skip_Salesforce_Flow}
      2. Operator: Is Null
      3. Value: {!$GlobalConstant.True}
  3. Click Save.

In the end, Melissa’s Flow will look like the following screenshot:

Almost there! Once everything looks good, click the Activate button.  

Proof of Concept

Now onwards, if a Task gets completed with the subject Case follow-up, then the flow will only execute for users whose profile does not equal the system administrator (because we have assigned custom permission to this profile). If you want to bypass flow for a single user, then consider using a permission set instead of using the profile.

Formative Assessment:

I want to hear from you!

What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

Preferred Timing(required)

11 thoughts on “Bypass Salesforce Flow for a Specific User or Profile

    1. Rakesh Gupta – Mumbai – 9x Salesforce MVP | Senior Solution Architect | 8x Author | 5x Dreamforce Speaker | Salesforce Coach | Co-host of AutomationHour.com and AppXchangeHour.Com

      Yes, the task is being created with a specific user account.

  1. Hi Rakesh, Does this bypass only when the user is running the Flow? What if the system is running the Flow, but the user with the bypass permission is being assign a lead in the Flow, will the user still be assigned the lead?

    1. Does this bypass only when the user is running the Flow? – Yes

      What if the system is running the Flow, but the user with the bypass permission is being assign a lead in the Flow, will the user still be assigned the lead? – Yes, the bypass logic is written to check if the user is logged in, not the owner.

  2. Hi Rakesh, where do you actually define that it bypasses Process Builder in this example? I only see a label and name ‘skip process builder’ in screenshot from step 1, that wouldn’t do it just by itself would it? Are you using Apex on the background somewhere?

    1. I have used Custom Permission to bypass process for specific profile.

      Please see the steps 1,2 and 3 very carefully

  3. Thanks for the post. Perfect example to understand Custom Permissions.

Leave a ReplyCancel reply

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

Discover more from Automation Champion

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%