In this post, we will go through the Flow Basics in Salesforce and How to use Flow Builder in Salesforce to automate the business processes. We will also go through the different types of Flows in Salesforce. Let’s just get into the good stuff.
What are different types of Flows in Salesforce?
We can create 5 types of Flows in Salesforce:
- Screen Flow: Guides users through a business process that’s launched from Lightning Pages, Communities, Quick Actions, and more.
- Record-Triggered Flow: Launches when a record is created, updated, or deleted. This auto-launched flow runs in the background.
- Schedule-Triggered Flow: Launches at a specified time and frequency for each record in a batch. This auto-launched flow runs in the background.
- Platform Event-Triggered Flow: Launches when a platform event message is received. This auto-launched flow runs in the background.
- Auto-launched Flow: Launches when invoked by Apex, processes, REST API, and more. This auto-launched flow runs in the background.
In later posts, I will implement all types of Flows in Salesforce to automate the unique business processes. If you don’t want to miss new implementations, please Subscribe here.
How to create a Flow in Salesforce?
To create a Flow in Salesforce, follow below steps:
- Type Flows in the Quick Find box and click on Flows under the Process Automation.
- Under How do you want to start building?, click on Freeform.
You can explore the Auto-Layout later as well. The only difference in Auto-Layout is that Flow Builder automatically position all elements and connectors for you. Whereas, Freeform gives developers the flexibility to control the placement of all the elements.
Flow Builder Basics: Toolbox
There are many components supported by Flow Builder as part of its Toolbox. Below are the Tools that are provided to add Elements.
- Interactions: We can use Screen, Action, and Subflow. These options depend on the type of Flow. For Example, Screen Interaction is only available for Screen Flows.
- Logic: It is used to add Assignment, Decision, and Loop in the Flows.
- Data: Used to perform DML Operations like Create, Update, and Delete Records. Also to Get records.
We can drag any of the above Elements and add them to the Flow Builder. An API name is assigned to Every Element, which will be available in the Manager section under Toolbox. We can refer to these variables in our Flow for Assignment, creating Loops, or performing DML operations. We can also create new resources/variables of any type to store the data from the Manager section.
The Resource Types that are supported are; Variable, Constant, Formula, Text Template, Choice, Record Choice Set, Picklist Choice Set, and Stage.
The supported Data Types for the above Resources are; Text, Record, Number, Currency, Boolean, Date, Date/Time, Picklist, Multi-select Picklist, Apex-Defined. And we can store multiple values as well.
For Example, drag the Screen Element onto the Canvas. Edit Screen modal will open. We can provide Screen Properties like Label and API Name. I have provided Flow Basics as a label. We can provide the other properties like Show Header, Footer. There is a setting to control the Navigation to display Next, Previous, Finish buttons.
We can add the Screen Components to the Screen. Let’s add Text Input on the Screen. Enter Text in the Search Components text box and drag and drop Text Input on the Screen. We can provide the Label for Text Input to display on Screen.
Then, we can connect the Start Element with our Screen Element with the help of Connector. Click the node at the bottom of the Start element and drag it to the Screen that we created. When the Flow is executed, Screen will be displayed to enter the value.
And as discussed earlier, two resources are created for the Screen component and Text Input.
The value that we will enter in the Text Input will be stored in Enter_Name variable as we named the Text Input as Enter Name with API name as Enter_Name.
Then, we can use other Elements like Assignment, Loop, or Data to perform some logic on these Resource variables.
Check this post to know How to use Assignment and Data Elements to create a record using Flow in Salesforce.
Once we are done with all the changes, click on Save and Enter Flow Label and Flow API Name. In the Advanced section, we can provide the setting for “How to Run the Flow” with one of the below options:
- User or System Context: Depends on how Flow is launched.
- System Context with Sharing: This enforces the Record level access.
- System Context without Sharing: Access to all the data.
Select this as per the business requirement. After saving the Flow, you need to activate it. If you want to make changes after activating, you first need to click on Save As and then either clone the current Flow with a new version or create a new one.
This is how we can use Flow Builder in Salesforce. In the next posts, we will explore the Flows more. We will implement different types of Flows with unique business requirements to cover all the aspects of Flows. If you don’t want to miss new implementations, please Subscribe here.
Below are some hand-picked implementations for you: