Salesforce Flows
by Martina Dimitrievska, Salesforce Developer at codeSTREETS
Part 1 of 2
This blog is part 1 of a series of 2 blogs targeting Salesforce Flows.
What Is A Flow In Salesforce?
A Salesforce flow, also known as Lightning flow, is an application used for automating complicated business processes. It allows users to gather specific datasets and performs automated processes using the same. Salesforce users can build individual flows based on their needs and preferences with the help of Flow Builder. Flow Builder allows you to develop code-like logic without a programming language. This makes the process of building Salesforce flows easier and faster.
Types Of Salesforce Flows
Salesforce flows can be divided into five major categories as follows:
- Autolaunched Flows
These Salesforce flows can be used for running automated tasks in Salesforce. They can be invoked by users from process builder, Apex class, record changes, set schedules, or platform events.
- Schedule-triggered Flows
These are autolaunched flows that can be launched at a specific time and for a specific frequency for every record in batches. These flows run in the background for automating your business processes.
- Screen Flows
These Salesforce flows have a distinct UI element and require inputs from Salesforce users. You can launch screen flows as an action or embed them as an element on a Lightning page.
- Record-triggered Flows
These are the autolaunched flows that run in the background when a user creates, updates or deletes Salesforce records.
- Platform Event-triggered Flows
These Salesforce flows run in the background when a platform event message is received.
When To Use Salesforce Flows?
Salesforce flows can be created and used to automate complicated business processes. However, it is vital to determine the kind of automation required before building a flow. For this, users must determine where the data required for the concerned process originates and where it must go. Always make sure that you consider whether the required results can be achieved through a Salesforce flow, a process, or a workflow field update.
If you need to generate a new automated business process or user-guided experience that does not reach the complexity threshold for Apex Code, then Flow is your go-to tool. Suppose you are modifying an existing process built with Process Builder or workflow. In that case, you should consider several factors when deciding whether to modify the existing process or migrate it to Flow.
Flows can create, edit, and delete records in Salesforce, send emails, show relevant data and gather user input, and generate outbound messages.
When Not To Use Salesforce Flows?
Here are some common situations wherein you should avoid using Salesforce flows:
-
It is never advisable to create a Salesforce flow when complicated logic is involved that can be managed better with an Apex code.
-
Creating a Salesforce is not an ideal option when your Salesforce edition limits the number of flows a user can create. Note that developers can write Invocable Apex methods that you can call from a flow (similar to calling a subflow). Using this pattern, you can offload especially complex processes to Apex but still have your flow builder maintain control of the overall process!
-
Salesforce Essentials and Professional editions provide users with a limit of five processes per process type and five flows per flow type. While operating on these editions, it is advisable to use a process.
How To Build A Flow?
Here are the important steps you need to follow to build a flow in Salesforce:
-
1. Start by opening the Flow Builder.
-
2. Type “Flows” into the Quick Find Box in Setup. Select the option of “Flows”, followed by clicking on “New Flow.”
-
3. Select the flow type based on your requirements, followed by clicking on “Create.”
-
4. Now, drag the elements you are willing to use to the canvas. Every element represents a specific action that can be executed by the flow, such as reading/writing Salesforce data, executing business logic, displaying information regarding flow users, collecting data from flow users, manipulating data, etc.
-
5. Connect the selected elements to ascertain the order in which they must be executed during the run time. Connect the “start” element to another element to begin the flow.
-
6. Once the elements are connected, save the flow.
After you have created a Salesforce flow, always make sure that you test it before activating the same.
Components used in a flow
-
Elements are the heart and soul of Salesforce Flow. Every complicated logic, assignment, or interaction in Flow goes with elements.
-
Connectors determine the path of Flow and the steps of what happens when in Flow.
-
Resources are custom data variables in strings, numbers, formulas, records, etc. These are used to enhance the before or after trigger functionalities of Flow.
Flow Elements
The Flow elements are divided into three categories:
- 1. Interaction
This category hosts Flow elements that gather information from the user, launch one or more sub-flows, and perform external actions. These elements consist of:
-
“Screen” is used to take inputs from and show messages to the user.
-
“Action” is the element used to ‘call’ other actions that may be based on objects, other users, etc.
-
“Subflow” can ‘call’ one or more sub-flows in Flow with the help of this element.
-
- 2. Logic
This category hosts all the logical operations and assignments you can perform on the input or selected records. Logic consists of:
-
“Assignment” is a simple assignment of values to the variables.
-
“Decision” makes a path Flow based on the given conditions. It creates two new paths. For example, a path for ‘True’ and the other for ‘False’.
-
“Loop” allows you to iterate over a record or value repeatedly.
-
“Collection Sort” sorts a given set of values or records.
-
“Collection Filter” filters out values or records based on the given filter.
-
- 3. Data
This Flow element handles all the operations related to Salesforce records. Data offers five sub-elements:
-
“Create Records” allows you to create records based on the values you’ve gathered through Flow.
-
“Update Records” allows you to update records based on the values you’ve collected from Flow.
-
“Get Records” enable you to fetch one or more records and store the required values for later use.
-
“Delete Records” performs the deletion of designated records within Flow.
-
“Roll Back Records” are cancellations to pending record changes.
-
What's in part 2
Part 2 of this series on Salesforce Flow will focus on the following:
-
Difference between Flows and Processes
-
Difference between Flows and Apex!
-
Common mistakes made when designing Flows
About codeSTREETS
codeSTREETS is a Registered Partner of Salesforce, with the HQ in Amsterdam, The Netherlands, and the Salesforce Center of Enablement in Skopje, North Macedonia.
If you want more information on how codeSTREETS can support your Salesforce Automation needs, contact us at contact@codeSTREETS.com.
Alternatively, you can read more about the Salesforce Services codeSTREETS delivers on our site.