Flows Overview in Salesforce...
What is a Flow ?
Salesforce Flow helps to build complex business solutions using clicks, not code. Flow is the most powerful tool that helps Salesforce Admin to perform multi-step automated logical processes that allow you to create new records, edit, or delete existing records, send email, outbound messages and other tasks based on criteria that you define.
How Flow Works?
Flow works with the help of elements, connectors, and resources.
Elements are any actions that the flow can execute, including subflows. Examples include reading or writing Salesforce data, displaying information to and collecting data from flow users, executing logic, or manipulating data.
Connectors are the defined paths that you specify that the flow will follow when it runs. For example, if a data update change corresponds with an email notification, you would use a connector to connect those two actions together.
Flow resources are values that you can use in the flow. For example, these could be objects (leads, contacts, companies) or fields (first name, last name, industry).
ELEMENTS The Flow elements are divided into three categories:
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.
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.
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.
The manager tab displays the existing resources. Each resource represents a value that is referenced throughout the flow. Some of the resources are Variables, Collections, Constants, Formulas, or Choices.
1. Variable: Variables are used to store data to use in the flow. The variables can be of type Text, Number, Record, Dates, Currency, Boolean, Picklist, or Object record, to name a few.
2. Collection: Collections are used to store a list of variables. They are used to process multiple records at a time.
3. Constants: Constants are values you set once and never change. Constants are recommended when the flow needs to reference the same value multiple times.
4. Formula: Formula is used to display a dynamic value depending on other values within the flow.
5. Choices: Choices are used in Screen flows to show options to the user.
Salesforce comes with two main Flow types – a Screen Flow and an Auto-launched Flow. The second type is further divided into four more types. Hence, collectively, we have five Flow types in Salesforce:
Platform Event-Triggered Flow.
Screen Flow requirements are used whenever we need inputs from the user. With a screen sample Flow implementation, you can create a screen (a custom UI) that can display messages, take input, and guide the user throughout the Flow process.
As the name suggests, a Schedule-Triggered Flow is scheduled and launched at the specified time for the given frequency. You can compare this Flow type with Apex batch jobs.
Auto launched flow with scheduled trigger
It runs automatically on a recurring schedule. It is helpful for jobs performed frequently or on a schedule (once, daily, weekly).
A Record-Triggered Flow is mainly incorporated when there is a need to make additional updates on the triggered record. When you create a new Flow and select a Record-Triggered Flow, you need to consider the object on which you want Flow.
You also need to take into account a Record-Triggered Flow, which can be triggered when:
A new record is created
An existing record is updated
A record is created or updated
A record is deleted.
Platform Event-Triggered Flow
A Platform Event-Triggered Flow can help you manage all your Salesforce automations in one Flow. It is an Auto-Launched Flow that runs in the background. It is launched when a new platform-event message is received.
A non-trigger Auto-Launched Flow is invoked only by Apex class, REST API, or a Process Builder. This Flow type covers abstraction, as you can perform complex problems triggered and solved in the background without letting the user know anything.
Navigation To Build A Flow In Salesforce
Below are the steps for building a flow in Salesforce:
Click on Gear icon Select Setup.
Type “Flows” in the Quick Find Box in Setup.
Select the option of “Flows”, followed by clicking on “New Flow.”
Select the type of flow based on your requirements Click on “Create.”
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 , executing business logic, Create/Delete/Get Records, displaying information on the UI ETC.
Connect the elements in the order in which they need to be executed. Make sure you connect the “start” element to another element to begin the flow.
Once the elements are connected, save the flow.
After a Salesforce flow is ready make sure that you test it before activating the same.