Last Updated on February 10, 2022 by Rakesh Gupta
Enjoy enhanced flow-building experience starting with Spring’19 release. Salesforce is at it again! – replacing Cloud Flow Designer (Canvas to design and build the flows) with a faster and robust tool – Flow Builder. It streamlines the process of – (1) flow building; and (2) maintenance – with a simplified user interface.
In light of the above, the first question that comes to mind is – what is the difference between Cloud Flow Designer and Flow Builder? Well, that is the very purpose of this article! – to give you an overview of Flow Builder and explain the difference.
I have started a series on Salesforce Flow to unearth basic concepts and help you to understand the power of Flow. If you haven’t subscribed to my blog yet, please do it now and get new blog post notifications in your inbox. You can do so by navigating to this page – Join Our Mailing List
Salesforce Flow is a tool that allows you to automate business processes by building applications known as Flows. Flow can be used to collect, create, update, and delete information in Salesforce. Flows can also execute logic, interact with the Salesforce database, call Apex classes, and guide users through screens for collecting and updating data. Once you design and develop Flows to fulfill the business requirement(s), grant access to Flows to your users. Let’s start with a business use case:
Business Use Case
Edward Backhouse is working as a System administrator at GurukulOnCloud. Edward is new to Flow Builder and was motivated to learn more about it after reading this article – Want to be an Early Adopter of the New Flow Builder? Welcome Aboard!. After reading the article, the following two questions arose in Edward’s mind:
- When to use Salesforce Flow vs Process Builder?
- What is a Variable and how to create one using Flow Builder?
Salesforce Flow vs Process Builder
These two tools have their own use cases – i.e., each tool is better suited to solve a specific kind of requirement or problem. Let’s start with a question – if you want to go to the moon you would more likely use a rocket, as opposed to walking, as a means of transportation. But suppose, instead of going to the moon, you tone down your goal and decide to go to the North Pole. In that case, yes, walking there may take ages but you may still be able to do so.
Now take a pause and think why I gave you this example? The above example explains the limitations of a human’s capabilities – for, a human can’t fly. The limitation is key here – if you understand platform limitations then, it will go a long way in helping you to find the right tools and design appropriate solutions.
Process Builder | Salesforce Flow |
Can’t be used to delete records. | Can be used to delete records. |
Not all objects are supported by Process Builder. | Many objects are accessible using Salesforce Flow. For example – OpportunityContactRole, UserDevice, etc. |
Can be triggered when a record is created or edited. | Can be triggered when a record is created, edited, or even deleted. |
Can’t be triggered after a successful login. | Can be triggered when a user successfully logs into Salesforce. |
Not possible to save the newly created record ID (If it is created using the Record Create element). | Possible to store the newly created record ID in a variable; so that, you can reference it in a flow later. |
Good for the intermediate use case. Like this one. | Much more power to implement complex logic. Like this one |
Can’t be used to capture user input(s). | Can be used to capture the user input(s) and later process it based on your business use case. |
Can be Schedule to run daily, weekly or once. |
Now if you want to deepen your understanding of the power of Process Builder and Salesforce Flow – check out my articles here.
Having understood the difference between Process Builder and Flow, let’s take the discussion forward and focus on Edward’s second question – What is a Variable, and how to create one using Flow Builder?
What is a Variable and how to create one using Flow Builder?
What is a Variable? – It is a container that stores information. If so then, what role does a Variable play in Flow?
Let us take a real-life example. Suppose if someone requests you to store two pounds of rice. The first thing you will do is to look for a container that is appropriate to store the rice – more likely than not, it would not be a fruit basket with holes! Similarly, suppose you are traveling, and want to carry some frozen food. In this case, you will look for a specifically designed bag/container to carry frozen food.
Notice that, in the above example, a container needed to store rice is different than a container needed to store frozen food. So, different containers are needed to store different types of items – A Ziploc bag may not be as desirable a container to store liquid – milk or juice – like a glass or a plastic bottle/box.
Variables in Flow are no different – different types of variables store different types of data. We call it – Data types. If a variable stores text, it will need a Text Data Type; if it stores numbers, it will need a Number Data Type. Therefore, before storing any data into a variable you must define its type. Here is the list of Variable Types in Flow.
Now some hands-on – let us create few variables:
We will create different types of variables as follows:
- A text variable to store the First Name
- An SObject Variable to store one lead record data
Creating a Text Variable
A text variable is used to store alphanumerics (character, digit, or both) – such as Rakesh or 18c Power House Road). To create a text variable in the Salesforce Flow, follow the instructions below:
- Login in to your developer org.
- Navigate to Setup (Gear Icon) | Setup | PLATFORM TOOLS | Process Automation | Flow.
- You’re now on the Flow management page. Based on your current org setting, you may see the following buttons:
- New Flow – Use this button to create a Flow in the new Flow Builder.
- New Flow in Cloud Flow Designer – Use this button to create a Flow in the classic (old) Cloud Flow Designer.
- Now follow the steps as shown in the video to create a Text variable:
- Once you’re done click on the Done button.
- Currently, in the Flow Builder, it is not possible to change the Data Type once you create a variable – check out the video for more details:
- Well done! You have just created your first variable using Flow Builder.
Creating an SObject Variable
SObject variable is used to stores field values for a Salesforce record. To create an Sobject variable – that stores a lead record fields value – follow the instructions below:
- Login in to your developer org.
- Navigate to Setup (Gear Icon) | Setup | PLATFORM TOOLS | Process Automation | Flow.
- You’re now on the Flow management page.
- Now follow the steps as shown in the video to create an SObject variable:
- Once you’re done click on the Done button.
- Navigate to Manager tab to access variable and resources which you added to Flow, as shown in the following screenshot:
- There! After creating an SObject variable, aren’t you feeling like a Pro?!
Assignments
-
-
- Create a variable that stores the Date of birth.
- Create a variable that is used to store multiple Opportunities records and their fields.
- Create a variable that is used to store one Opportunity record and its fields.
- Create a variable to store the annual revenue of the customer.
-
Proofreader: - Munira Majmundar
In differentiation of process builder and Flows, now we can use process builder to update Opportunity Contact Role record
The Idea was delivered :Process Builder – Allow Action to create Opportunity Contact Role record
https://trailblazer.salesforce.com/ideaView?id=08730000000DfjqAAC
Hi Rakesh,
. https://automationchampion.com/2021/01/18/clone-a-user-with-their-associated-public-group-queue-membership-and-permission-sets/
i have followed this link to create the Flow for my business use case but not able to handle the Time field datatype. There is any way to handle the TIme field in Flow builder.
You’re right. You may want to upvote ‘Support Time Fields be available in Process Builder and Flows‘ idea
Hi Rakesh Sir,
Can we pull Records/fields From two differents Objects in one variable like {!Opportunity.amount} and {!Passenger.RegistrationFees_c} ? If Yes, Can you please Guide me on the procedure to do that?
Yes, use Text Variable
Hi Rakesh,
In Assignment 2 ,it is saying “Create a variable that is used to store multiple Opportunities records and their fields.”
Don’t we check the checkbox named “Allow Multiple Values” since we are creating multiple records and their fields?
Since in the screenshot I have seen the checkbox is unchecked.
Thank you
Syed,
You’re right on Assignment 2 on selecting Allow Multiple Values.
Under Assignment 2 – I am trying to create Sobject variable to store multiple records. How do we specify fields? or how to specify one to multiple opportunity
Check out this screenshot
Hi Rakesh,
What did you mean by creating a Sobject? Isn’t it just a Record Variable that you’re creating?
Is sobject just a naming convention that you use when creating these type of variables?
Thanks
Yes, you’re right. An sObject variable represents a row of data which is equivalent to a Record Variable in Salesforce Flow.
Hi Rakesh,
I’m unable to play the attached videos. Please help me with this:)
Regards,
Ram.
Hey, can you please try again? Thank you!
Hi Rakesh,
I want to run flow when any record delete
Ankit, at the moment Flow only runs when a record is created or edited. You need to call Flow from Apex trigger.
Hi Rakesh
How can we read login Url through flow?
how to store the read URL in to variable?