Skip to main content

Create a Flow

The last business rule functionality to implement before testing your application is a rule to set the Out-of-State checkbox field on the Travel Approval object if out-of-state travel has been chosen. Salesforce offers workflow capabilities that provide a declarative, drag-and-drop design environment to build our business process logic. 

Get Started with Flow Builder

You may have heard several terms used interchangeably when referring to flows. As a reminder, the official terms are:

  • Salesforce Flow—The product that encompasses building, managing, and running flows and processes.
  • Flow Builder—A point-and-click tool for building flows.
  • Flow—An application that automates a business process by collecting data and doing something in your Salesforce org or an external system.

In short, the Salesforce Flow product includes a couple of tools. One of them, Flow Builder, lets you create flows.

Flow Building Blocks

Every flow is made up of three building blocks. 

  • Elements (1) appear on the canvas. To add an element to the canvas, drag it there from the toolbox.
  • Connectors (2) define the path that the flow takes at run time. They tell the flow which element to execute next.
  • Resources (3) are containers that represent a given value, such as field values or formulas. You can reference resources throughout your flow. For example, look up an account’s ID, store that ID in a variable, and later reference that ID to update the account.

Now, create a flow that uses the update record node to set the out-of-state flag.

  1. From Setup, click the Home tab.
  2. Select Process Automation | Flows (or use the Quick Find and search for flows).
    Flow window in Setup
  3. Click New Flow.
  4. Select Record-Triggered Flow then click Create.
  5. Enter these values:

Parameter

Value

Object

Travel Approval

Configure Trigger

Trigger the flow when: A record is created or updated

Condition Requirements

None

Optimize the Flow For:

Fast Field Updates


  1. The Configure Start screen should look like this:

The Start element's configuration panel corresponding to the preceding steps.

6. In the Layout dropdown, select Freeform.

Freeform selected in Layout dropdown

Add a Decision Element

  1. From the left-hand toolbox column, drag a Decision element onto the flow builder screen.
  2. Set the following parameters:

Parameter

Value

Label

Is Travel Out of State?

API Name

Is_Travel_Out_of_State (This automatically gets set when you tab out of the Label field)

Description

Leave blank


  1. Set the Outcomes.
  2. For the first outcome, set these parameters:

Parameter

Value

Label

Yes Out of State

Outcome API Name

Yes_Out_of_State (This automatically gets set when you tab out of the Label field)

Condition Requirements to Execute Outcome

All Conditions Are Met (AND)

Resource

$Record > Destination State

Operator

Does Not Equal

Value

TX

When to Execute the Outcome

Only if the record that triggered the flow to run is updated to meet the condition requirements



  1. Your Edit Decision Screen should look like this:
    Edit Decision screen with values entered
  2. Next to Outcome Order click the + button to add another outcome.
  3. Set these parameters:

Parameter

Value

Label

In State

Outcome API Name

In_State (This automatically gets set when you tab out of the Label field)

Condition Requirements to Execute Outcome

All Conditions Are Met (AND)

Resource

$Record > Destination State

Operator

Equals

Value

TX

When to Execute Outcome

Only if the record that triggered the flow to run is updated to meet the condition requirements


  1. Click Done.
    Second edit decision screen with values entered.
  2. Drag the white circle from the Start Flow element to the Decision element you just created to link the direction of the arrow. Start Flow and Decision elements connected in the flow panel

Create an Action for the Flow Using Update Records Elements

  1. From the left-hand column, the flow toolbox, drag an Update Records element onto the flow screen.
  2. Set the parameters for the element:

Parameter

Value

Label

Update Travel Approval Record

Outcome API Name

Update_Travel_Approval_Record (This automatically gets set when you tab out of the Label field)    

How to find Records to Update and Set their Values

Use the travel approval record that triggered the flow    

Condition Requirements to Update the Record

None—Always Update the Record

Field

Out_of_State__c

Value

$GlobalConstant.True (start typing True and this value will come up)

Edit Update Record screen with values selected.

  1. Click Done.
  2. Drag the white circle from the Decision Node to the Update Records you just created, and select the decision Yes Out of State | Done.Start Flow, Decision, and Update Records elements connected in the flow panelTo save time, you can simply duplicate the Update Records element you just created and update the criteria.
  3. Click the Update Records node and make sure it is highlighted in blue. In the top-left corner of the Flow Builder screen, find the and click the duplicate button Duplicate button. Double-click on the new Update Records element just created. Note the API name has been automatically updated to Update_Travel_Approval_Record_0.
  4. Then update the Value of the Out_of_State__c field to FALSE.
  5. Delete the True Value and enter False. Select $GlobalConstant.False. Edit update records with values selected.
  6. Click Done.
  7. Drag the white circle from the Decision Node to the second Update Records you just created and select the decision In State.Start Flow, Decision, and both Update Records elements connected in the flow panel

Congratulations!! You’ve completed your first Record Triggered Automation Flow! Last but not least, make sure to save and activate the flow. 

  1. Click Save.
  2. Flow Label: Out of State Travel Flag. Flow API Name will auto populate to Out_of_State_Travel_Flag. Leave Description blank and advanced settings as is.
  3. Click Save. 
  4. Click Activate.

Your flow is now active and you are officially an automation expert! 

Flow is a powerful tool that you use to automate many actions within your Salesforce Applications. Next, learn how to build an approval process for any Salesforce record.

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities