Table of Contents
Flow is an automation tool in Salesforce that empowers us to build complex business processes using clicks, not code.
Examples: Sending an email, posting a chatter, updating a record, and so much more.
Before we start creating flows, let’s familiarize ourselves with key terminologies.
- Salesforce Flow
This is the umbrella term in Salesforce for everything and anything that enables us to create, manage, and run automation with clicks, not code.
The Flow is an automation configuration in Salesforce that enables us to automate complex business processes. It has a flowchart structure and works by collecting and using that data to get things going.
- Flow Builder
It is the application on which we build flows.
Types of Flows
Flows come in a few different flavors.
A. Screen Flow
These flows include a UI element that guides users through a business process and requires user input.
B. Scheduled Triggered Flow
These flows run based on a scheduled time and rate for each record in a batch and do not support user interaction. This is ideal for recurring business processes.
C. Record-Triggered Flow
These flows are triggered when a record is created, updated, or deleted. Formerly, we used Apex triggers for such automation.
D. Platform-Event Trigger
These flows are triggered when a particular platform event message is received.
E. Auto Launched
These flows run automated tasks when invoked by other flows, from with an Apex class, Process Builder, or even REST API.
Flow Builder User Interface
Follow along to launch the Flow Builder:
- Open Setup
- Then type Flows within the Quick Find Box,
- Click Flows.
- Now Click New Flow.
- Select a Flow Type, and then click Create.
Let’s take a look at the various parts of the Flow Builder.
The toolbox includes the various elements and resources we’ve used in the flow.
B. Button Bar
The button bar helps us manage the flow as we build it. Let’s take a look at each of the components present in the button bar from right to left.
- Click Save to save the flow.
- Click Save As to save a new version or a new flow.
- Click Activate to make the current version of the flow available to Users.
- Click Debug to test the most recent save of the open flow version.
- Click Run to run the most recent save of the open-flow version.
- Choose between Free-Form or Auto-Layout to decide the layout style for the flow.
- Click on the gear icon ( ) to edit the Version Properties.
- Click this icon ( ) to undo or redo.
- Use Select Elements to select multiple elements to use in a different flow.
- Click to hide/show the toolbox.
This is where we add the various elements to the canvas to build a flow.
Flow Building Blocks
We use combinations of elements, connectors, and resources, a.k.a, building blocks, to build flows.
Each element denotes an action that the flow can execute. In Auto-Layout, click on to add an element. There are three different types of elements, and each does something different.
A. Interaction Elements
These elements enable the flow to interact with the User by presenting questions or sending various communications.
- Screen Element
These elements either display data to users or collects data from the User.
- Action Element
Helps perform an action outside of the flow. For example, post a chatter or submit it for approval.
- Subflow Element
Launches another flow that’s available in our org.
B. Data Elements
Data elements instruct the flow to interact with records in the Salesforce database. We can use data elements to:
- Create Records
- Update Records
- Get Records
- Delete Records
C. Logic Elements
Logic elements are used to evaluate and manipulate the data based on the business process. With logic elements, we can:
- Create multiple paths that the flow can take.
- Create a looping path.
- Pause the flow for a specified period.
- Update temporary data to be used later in the flow.
- Change the order or contents of a collection of data.
Each connector represents the paths the flow can take when it runs. The connector guides the flow to the next element to be executed. There are different types of connectors available, more on that soon.
Each resource represents a value that we can reference throughout the flow. We can create a new resource by clicking New Resource. Some resources are automatically created when we add an element to the flow, and others, such as global constants and global variables, are offered by the system.
In Flows, variables are a type of resource that acts as a container that holds a piece of information. These values can be changed (or varied), thus the name. Most of the flows we create require at least one variable to function. Every time a flow runs, all the variables start with their default values. If the default value is blank, the variable starts as blank. Variable values are never carried from one instance of a flow to another or from User to User.
Examples of variable use cases:
- Store the result of joining two strings.
- Store a number value that’s greater than the rest.
- Keep a count of how many times a loop has run.
Type of Variables
The following list includes some of the frequently used variable types:
Let’s create a Variable
1. From Setup, type Flows within the Quick Find Box, and then click Flows.
2. Click New Flow.
3. Select a Flow Type, and click Create.
4. Open the Toolbox.
5. Click New Resource.
6. Enter the following:
- Resource Type: Variable
- API Name: test_variable
- Data Type: Text
7. Click Done.
That’s it! We create a variable that we can use later on in our flow. You can find the variable as and when required in the toolbox.