Author: Rishabh Dubey
● Flows allow you to build complex business automation using clicks instead of code. As an admin, Flows are going to be your best friend because you will be able to handle the majority of complex business requirements without the help of a Salesforce developer!
● The benefit of Salesforce Flow is that they are easy to maintain because anyone (assuming they know Flows) should be able to follow along with what you built.
● Flows are accessible through the Setup menu. Simply enter ‘Flows’ into the Quick Find box, and create a new Flow to get started
Flow vs Workflow/Process
|Complexity||A single If/Then statement||Multiple If/Then statement||Complex|
|Supports Time based Actions||YES||YES||YES|
|Support user Interactions||NO||NO||YES|
|Starts When||Record is Created / Changed||1. Record is Created / Changed|
2. Invoked by another process.
3. Platform Event message is Received
|1. User clicks on a button or link|
2. User access Lightning page,Community page, Visulforce page or Custom tab
3. User access item in utility bar
4. Process starts
5. Apex is called
6. Record is created or Updated
|Call Apex Code||No||YES||YES|
|Create Records||TASK ONLY||YES||YES|
|Launch a Flow||NO||YES||YES|
|Post to Chatter||NO||YES||YES|
|Send Email||YES (EMAIL aLERT ONLY)||YES (EMAIL aLERT ONLY)||YES|
|Send Outbound messages without code||YES||NO||YES|
|Submit for Approval||NO||YES||YES|
|Update Fields||Record of its Parent (Only master record)||The Record or its parent or child||ANY RECORDS|
Type of flows
Screen Flows : A Screen Flow is called through a button or action, or displayed in a Lightning Page or the Utility Bar, and appears as a screen to the user to interact with. This cannot be automatically called.
Scheduled Trigger Flow : A Schedule-Triggered Flow runs automatically to a recurring schedule. This is handy for tasks that need to be performed daily on a set of records, or to handle jobs that run frequently.
Autolaunched Flows : Autolaunched Flows are called through Apex, Process Builder, or another Flow. They can be used to perform actions automatically behind the scenes.
Record-Triggered Flows : Record-Triggered Flows begin when a record is created or updated, very similar to Process Builder (more on this later).
Platform Event-Triggered Flows : Platform Event-Triggered Flows are called when a platform event is received, similar to an Autolaunched Flow.
Building Blocks of Flows
1. Elements are the individual building blocks of the Flow. These perform logical actions such as assignments, decisions, or loops. There are also data elements that will query the database or commit record changes.
A Screen element, only available in a Screen Flow, allows you to present a screen to the user. It can be used to collect information from the user.
An Action element allows you to pass data through to a pre-existing standard or custom action such as Send Email, a Quick Create, or a custom Apex action.
A Subflow element allows you to call another Flow within your current Flow.
- Logic Elements
Assignments allow you to give a value to a variable
Decisions allow you to split your Flow depending on the data that’s being sent through it.
Loops allow you to handle multiple variables at once using collections.
Sort Collection is used to Sort items in collection.
Collection filter allows you to without changing the original collection removing additional values based on sub conditions.
- Data Elements
Create Records Allows you to created records using values from the flows
CCreate Records Allows you to created records using values from the flows
UUpdate records Allows you to update salesforce records using values from the flows
G Get records Allows you to query salesforce records and store their values to use later in the flow
Delete Records Allows you to Delete salesforce records
2. Connectors determine which element leads to which. Winter ‘21 enables Auto-Layout, and connects the Elements together automatically.
3. Resources are the individual variables of data that are to be used in a Flow – these can be strings of text, numbers, records, formulae, or collections.
Variables : Variables are where you can store data to use in the Flow. These can be Text, Number, Record, Dates, Currency, Boolean, or Picklists just to name a few
Collections : Collections are a group, or ‘list’, of Variables stored together. Collections allow you to process multiple records at once, or ‘bulkify’ your Flows
Constant : Constants are values you set once and never change. They are useful when you want to refer to a single value multiple times through your Flow – if you ever need to change that value, you just need to change it once and it is reflected throughout the Flow.
Formula : Formula displays a dynamic value depending on other values within your Flow. If you need to calculate a future date based on when the Flow was run, a Formula will be helpful. If you need to calculate and set a currency based on an interest rate, a Formula can be used.
Choices : Choices are used within Screen Elements to display an option to the user