A step-by-step Guide on How to create a Screen Flow in Salesforce
Salesforce Flow enables users to build complex business solutions using clicks, not code. In this article, we'll discuss what Salesforce Flow is, how flows simplify business processes, focus on the Screen component, and also provide you with a guide on how to create a Screen Flow in Salesforce.
What is Salesforce Flow?
Flow is the most powerful automation tool provided by Salesforce for automating everything from sending emails and custom notifications to using triggers that create, update, or delete records in Salesforce.
There are the following types of Flow:
Screen Flow:\ With Screen Flow, you can create your own interactive UI and guide the user through the desired business process, which you can run from Lightning Pages, Experience Cloud, and more.
Scheduled-Trigger Flow:\ Such a Flow is activated at a specified time and with a planned frequency. It is an excellent alternative to Apex batch jobs that developers use for similar tasks.
Record Triggered Flow: \ This Flow is activated when a Salesforce record is created, updated, or deleted. Previously, Apex triggers for these automations were used, but now some of them can be performed with Flow.
Platform Event Flow:\ It is activated when receiving a Platform Event message. For example, we can load data from a third-party service and then use Flow to separate it and create records in different Salesforce objects.
Auto-launched Flow:\ Runs from Apex, Process Builder or REST API.
Interaction components of Salesforce Flow
Salesforce provides a large selection of different components, which are a set of various actions that you can use to perform various kinds of operations.
Screen component allows the creation of a UI that guides the user through the business process;
Action component pauses the Flow until the specified Aura Enabled component is executed;
Subflow component launches another Flow while the current one is executing.
The components of Salesforce Flows take a closer look at next.
You may also like: "Salesforce Plugins overview: types, detailed overview, examples, screenshots, useful links"
Logical components of Salesforce Flow
Salesforce Flow allows performing Logical operations on data, such as:
Assignment is used to set values to variables, collection variables, record variables, record collection variables, and global variables;
Decision is a flow element that allows you to evaluate a set of conditions and guide users through the Flow based on the results of those conditions;
Loop is a Salesforce Flow element that is used to loop through multiple items in a variable collection;
Collection sort component is used to sort a collection's items in ascending or descending order and optionally reduce the amount of items in that collection to the given number.
Data (SFDC) components of Salesforce Flow
Data (SFDC) components are used to interact with the database and perform CRUD operations on records:
Get Record. With this element, you can easily find Salesforce records that match the filter conditions and store their values in variables.
Create Record. Allows you to create as many Salesforce records as you want using variables or other values from the Flow.
Update Record. Identify the Salesforce records you want to update and set the values you want to change in those records. To do this, use identifiers and field values stored in a record variable or record collection variable, or use special conventions to identify records and set field values separately.
Delete Record. With this component, you can delete specific Salesforce records by using identifiers stored in a record variable or record collection variable or by specifying conditions.
How to create a Screen Flow in Salesforce? The Step By Step Guide with screenshots
Screen Flow is a type of Flow that allows us to interact with the user through a UI where they can either enter some data or select entries. This Flow provides the user with instructions and input fields, and after filling, performs defined actions such as: creating, updating records, etc. The users will navigate through a series of screens we've created without writing a single line of code. Let's imagine that we need to give the user the opportunity, being on the company page, to add new workers to this company, while filling in all the necessary fields. Screen Flow can help us with this task. Let's try to create such a flow together.
1. First, create a new Flow and select the appropriate type (Screen Flow).
2. Then add a new Screen component.
3. A pop-up with the component settings will appear on the screen. Enter the title for this component in the “Label” field, and the “API Name” field will be filled automatically.
4. There is an opportunity to remove unnecessary buttons and rename the “Finish” button in the “Configure Footer” section.
5. Now we need to add some necessary fields. To do this, find the appropriate type of component in the left section and drag it. After that, in the “Label” field on the right, enter a name for each field and click “Done”.
6. Now when we are done with the screen component, we need to save all the data entered in the screen component to the database. For that, we need to add the "Create Record" element after the Screen component.
7. Next, we need to name our new component and do some tune-ups. For that, in the "How to Set the Record Fields" section, select the "Use separate resources and literal values" option. We will be creating a Contact object record, so we select it below.
8. Now we need to map the fields from the Screen component to our Contact record. At the very bottom of the window, in the “Set Field Values for the Contact” section, there are two sections: “Field” and “Value”. The “Field” section contains all the fields of the Contact object, and the “Value” section contains all the values that are available in our Screen Flow. So, let's select the necessary fields on the Contact object and the corresponding ones from our Screen component.
9. But that's not all: we still need to make sure that the newly created Contact record is linked to our Account record. To do this, we need to add another field that will accept the Account Id, and the value of this field will be the global variable Flow → CurrentRecord.
10. Click the "Done" button, and then click the "Save" button in the upper right corner to save our Screen Flow. In the Flow Label field, enter a name for our flow and click “Save” again.
11. And don't forget to activate your flow, otherwise you won't see it in the list of available components on the page layout.
12. Now add our flow to the Account page and that's it.
13. The component is added and it works.
Salesforce Flow is a very powerful and useful declarative development tool that enables you to do useful things without writing a single line of code. Today we learned about what Flow is, about the main elements of Flow, and we looked at the Screen Flow type as an example in more detail.
If you still have questions about Screen Flow setting up, or questions about other types of Flow, contact us, and we’ll help you to deal with that.