Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Route and Reorder Flow Elements

Learning Objectives

After completing this unit, you’ll be able to:

  • Create a decision element that checks a custom permission.
  • Connect flow elements with a nonlinear connection.
  • Cut and paste elements on the flow canvas.
Note

This badge is one stop along the way to Flow Builder proficiency. From start to finish, the Build Flows with Flow Builder trail guides you through learning all about Flow Builder. Follow this recommended sequence of badges to build strong process automation skills and become a Flow Builder expert.

Before we wrap up this badge, let’s go over some useful techniques to control how your flow runs.

Power-Up Decisions with Custom Permissions

There’s a global variable we didn’t cover in the Data and Actions in Flows badge, because it pairs perfectly with the Decision element, like chicken with donuts. (If you haven’t, try it sometime!) 

The Running User's Permission global variable (which might be called $Permission in some elements) returns TRUE only if the running user has the specified custom permission. Using the Running User's Permission global variable with custom permissions allows you to build a flow that branches based on the user’s permissions.

Note

Custom permissions can be assigned to profiles and permission sets. Certain tools, such as validation rules, restriction rules, and flows, can check if the running user’s profile or permission sets have the custom permission.

You can combine the Running User’s Permission global variable with the Decision element to make your flow take different paths depending on who’s running the flow. 

In the Decision panel's Resource picklist, you can select the Running User’s Permission global variable.

Let’s look at another example scenario. Pyroclastic’s customer-onboarding managers have asked for an automated tool that guides users through their onboarding projects. After listening to their needs, Flo understands that the project kickoff screen should be shown only to specific project leads, users who have the Onboarding Lead permission. Everyone else should see a message that instructs them to contact an onboarding lead. 

Diagram prompts User has permission? If yes, Show project kickoff screen. If no, Advise the user to contact an onboarding lead.

To check for this permission, the Decision element checks if Running User’s Permission > Onboarding_Lead is equal to true.

Note

When you’re setting criteria to check any true or false condition, don’t forget to use the “True” global constant. (If you completed the Flow Builder Basics badge, you might remember that a constant is like a variable, except that its value can’t change.)

Same as previous diagram but the prompt is now Running User’s Permission > Onboarding_Lead = True.

If the running user has the permission, the flow runs the path with the project kick-off screen; if not, the flow runs the path with the prompt to contact an onboarding lead.

Create a Decision Element That Checks a Custom Permission

Before you build the flow, create a custom permission named Onboarding Lead.

  1. From Setup, enter permission in the Quick Find box and then click Custom Permissions.
  2. Click New.
  3. For Label, enter Onboarding Lead.
  4. Make sure the Name is Onboarding_Lead.
  5. Click Save.

Now build the flow.

  1. Create a screen flow.
  2. Add a Decision element.
  3. For Label, enter Onboarding Lead?
  4. Update the New Outcome:
    • For Label, enter Yes.
    • For Resource, select Running User’s Permission > Onboarding_Lead.
    • For Operator, select Equals.
    • For Value, select True.
      A group of criteria fields with Resource set to Running User’s Permission > Onboarding_Lead, Operator set to Equals, and Value set to the global constant True.
  1. Change the Default Outcome Label to No.
  2. Save the flow. For Flow Label, enter Onboarding Project Initiation.

Make a Long-Distance Connection

The Flow Builder canvas keeps your elements neat and tidy, and prevents connectors from becoming a tangled mess. But sometimes you don’t want to just flow along for the ride; you need to flow your own way, to boldly flow where no flow has gone before!

You can connect an element to any other element on the canvas, even a previous element, using a Go To Connector. Go To Connectors create nonlinear connections in your flows, and hide their paths to prevent clutter and confusion.

The Go To Connector name matches the name of its destination element.

Note

If you arrange connectors in a way that runs an element more than once, Flow Builder won't stop you if that behavior forms an infinite loop (one that keeps repeating and never ends). When it runs, the infinite loop will exceed Salesforce limits and cause an error. Even finite loops can hit limits if you’re not careful. Short, simple loops that run through a few elements a few times are sometimes okay, but be sure to test them thoroughly in a sandbox. For anything more complex than that, use a Loop element.

Follow these steps to connect to another element.

  1. On the connector that you want to reroute, click Add Element.
  2. Click Connect to element.
  3. Click Select Element on the element that you want to connect to.

Click the connection text to highlight its destination, or click the number of connections text to highlight the origin.

If a branched path doesn’t merge with the other paths, you can use this method to reconnect it. Just click Add Element before the path ends and follow the same steps.

Move Your Elements Here, There, and Everywhere

Sometimes your beautiful, elegant, genius flow creation… turns out not so perfectly. Or maybe it would’ve been perfect if it weren’t for those meddling users! Either way, sometimes you want to move an element to a different location on the canvas.

Follow these steps to move an element from one location to another.

  1. Click the element that you want to move.
  2. Select Cut Element.
    The context menu for a selected element on the canvas includes four commands (Copy Element, Cut Element, Delete Element, Add Fault Path) and an Edit Element button.
  3. Hover over Add Element where you want to move your element, and click Paste. The element leaps to its new home.

Auto-Layout is the fastest, cleanest, and most feature-rich way to build flows. But if you need to move a whole bunch of elements, it’s sometimes faster to switch to Free-Form temporarily. In Free-Form mode, select the connector and press Backspace or Delete. Create a new connector by clicking and dragging the circle at the bottom of the element to the connector’s new target.

Resources

Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback