Learning Objectives
In this project, you’ll use Flow Builder to build a working flow that:
- Captures information from a user.
- Queries your Salesforce org for a record that matches what the user enters.
- Decides whether to update the matching record or create a new one.
- Creates or updates a record.
Introduction
This project walks you through the motions of building a simple flow. Launch your Trailhead Playground now to follow along as we complete this project. Follow the instructions and observe how the various controls work in Flow Builder. By the end of this project, you’ll have a working flow. To open your Trailhead Playground, return to the Trailhead website and scroll down to the hands-on challenge, then click Launch. Let’s get started!
Create the Flow and Add a Screen
- From Setup, enter Flows in the search box at the top of the page and select the result for Flows | Process Automation.
- Activate the New Flow button, then select the Screen Flow radio button and click the Create button.
- From the section below the toolbox heading, add a Screen element onto the canvas. Click the Add Element button and choose Screen from the list.

The New Screen window opens near the bottom of the page.
- Under the Screen Properties heading, enter Contact Info into the label field.
- The API Name is automatically set to Contact_Info when you TAB into the field.
- Activate the Done button. The canvas now includes three items: Start, Contact Info, and End.
- Activate the Save button, and enter these values
Field |
Value |
Flow Label |
New Contact |
Flow API Name |
New_Contact |
- Activate the Save button.
Because you plan to capture contact information from the user, let’s create a record variable to store that contact record data in the flow.
- In the Toolbox, press ENTER on the New Resource button beneath the Manager tab.
- For Resource Type, select Variable.
- For API Name, enter contact.
- TAB to the Data Type edit combo box and select Record.
- In the edit combo box for Object, enter Contact.
- Activate the Done button. In the toolbox, the Manager tab now contains a heading called Resources. You will find a contact record variable resource listed there.
- Activate the Save button.
You need to create form fields for the user to enter contact information on the screen. Let’s start with an input component that collects the contact’s name.
- Under the Elements heading, press ENTER on the Contact Info button. The Edit Screen window opens.
- In the Components pane, enter Name in the search box then press TAB twice to move into the list of results.
- Press ENTER on the result for Name to move it onto the screen canvas.
The heading level two called Name now marks an area for editing properties of the Name input component.
- Under the name heading level two,, for API Name, enter contactName. That’s one word.
- Navigate down the page and press ENTER on the Advanced button. Make sure the Manually assign variables checkbox is checked.
- Complete these steps to take what the user enters in the First Name and Last Name fields and store those values in the contact record variable.
- In the First Name field, enter {!contact.FirstName}
- For Last Name, enter {!contact.LastName}
- Activate the Done button.
- Activate the Save button.
Now let’s add the picklist for the user to select the contact’s parent account.
- On the canvas below the Elements heading, press ENTER on the Contact Info button.
- In the Components pane, enter Picklist in the search box and press TAB twice to move into the list of results.
- Press ENTER on the result for Picklist to add it to the screen canvas just below the Name component we added earlier.
The Picklist heading now marks the section where you can edit properties of the Picklist input component
- Under the Picklist heading, enter these values
Field |
Value |
Label |
Account |
API Name |
Account |
Data Type |
Text |
- Under the Configure Choices heading, TAB to the Choice edit combo field and select New Choice Resource. Enter these values:
Field |
Value |
Resource Type |
Record Choice Set |
API Name |
accounts |
Object |
Account |
Condition Requirements |
None—Get All Account Records |
Choice Label |
Name (also shows up as account.name) |
Data Type |
Text |
Choice Value |
Id (also shows up as account.id) |
- Under the Store More Account Field Values heading, complete these steps to store the ID of the user-selected account in the contact record variable.
- For Field, select Id. This also shows up as account.id.
- For Variable, enter {!contact.AccountId}
- Click the Done button twice on two different screens.
- Click Save.
Now let’s add the toggle for the user to specify whether (or not) to update an existing contact if one is found.
- On the canvas below the Elements heading, press ENTER on the Contact Info button.
- From the Screen Components pane, enter toggle into the search field and choose the result for Toggle to add a toggle component to the canvas. IT will be added just below the Account picklist component.
- Under the Toggle heading, enter these values. Take note of the underscore in the middle of the API name and be sure to enter it exactly as it appears below.
Field |
Value |
API Name |
update_toggle |
Label |
If this contact already exists, update the existing record. |
Active Label |
Update existing |
Inactive Label |
Create other contact
|
- Press ENTER on the Advanced button to expand the panel.
- Ensure the Manually assign variables checkbox is not checked.
- Under the Revisited Screen Values group, select the radio button for Use values from when the user last visited this screen.
- Activate the Done button.
- Activate the Save button.
Close and Open the Flow
- To exit Flow Builder, press ENTER on the Back link at the top of the page. The flow list page appears.
- To reopen the flow in Flow Builder, find the cell containing New Contact in the table on the flow list page and press ENTER on it.
Run the Flow to View the Screen
At this point, your flow can collect contact information from the user and store that information in flow variables. Let’s see what the screen looks like to users who run the flow.
- Near the top of the page, activate the Run button.
- Enter any values, select any account from the list, and press ENTER on the Finish button.
Because the flow has no elements to execute after the screen, nothing happens when the flow finishes. The flow simply runs again, which means that you see the screen again.
Congrats on building and even running a flow! So far, the flow only displays a screen that accepts user input. Next, you configure the flow to compare some of that user input with data in your org.
Click to return to the unit on Trailhead to verify this step.