What are Flows?
In Salesforce, a flow is an application that automates complex business processes. Simply put, it collects data and then does something with that data. Flow Builder is the declarative interface used to build individual flows. Flow Builder can be used to build code-like logic without using a programming language.
Different types of flows :
The Salesforce Flow can be classified into five subtypes-
- Screen flows -: It can be called using a button or an action or displayed in a Lightning Page or the Utility Bar. It appears as a screen for the user to interact with. Screen flow cannot be automatically triggered.
- Schedule-triggered flows -: It runs automatically on a recurring schedule. It is helpful for jobs performed frequently or on a schedule (once, daily, weekly). It will run on the defined particular time on the particular Schedule (once, daily, weekly).
- Autolaunched flows -: These can be called Apex, Process Builder, or another Flow. They can perform actions automatically behind the scenes.
- Record-triggered flows -: It begins when a record is created or updated. Its functionality is similar to Process Builder. Record Triggers Flows calls when :
- Platform Event-triggered flow -: These are called when a platform event is received.
Type of Flows
Flow Building Blocks
Flows use three building blocks: elements, connectors, and resources.
- Elements are nodes on the canvas that makes things happen. To add an element to the canvas, click Add element.
- Connectors are lines on the canvas that define the path the flow takes when it runs. They tell the flow which element to execute next.
- Resources are containers that don’t appear on the canvas but are referenced by the flow’s elements. Each resource contains a value or a formula that resolves to a value. For example, your flow can search for an account’s ID, store that ID in a variable, and later use that variable to tell the flow which accounts to update.
Types of Elements -:
- Interaction – Flows can interact with users by presenting questions and information on a screen, or by sending various types of communications. The Screen element and the Action element make these interactions possible.
- Data – Data elements instruct the flow to interact with records in the Salesforce database. Use data elements to look up, create, update, and delete Salesforce records. You can work with one record at a time, or many records all at once.
- Logic – With logic elements, you can evaluate that data and manipulate it according to your business requirements.
Connectors -: Connectors define the path that the flow takes as it runs. They tell the flow which element to execute next. There are different types of connectors that tell the flow to take a different path in certain circumstances, but most of the time, the flow follows its connectors from one element to the next.
What Is a Variable?
In a flow, a variable is a container that holds a piece of information. Flow stores values in variables, but those values can be changed by the flow.
Why Do I Need Variables?
- In a screen flow, store the ID of the record that the flow is displayed on, so you can tell the flow which records to update at the end of the flow.
- Store a number value that can be higher or lower depending on user choices.
- Store the result of joining two text strings together.
- Retrieve record values to use in calculations, copy to another record, or display to a user.
- Assemble a collection of values that you can use to create a record.
- Make changes to every record that meets certain criteria.
- Delete every record that meets certain criteria.
- Keep a running tally of how many times a loop has run.
What Can I Store in a Variable?
- Text: A string of letters, numbers, and characters. If you just need to store a Salesforce ID, and not a whole record, use a text variable.
- Number, Currency: A numerical value. Don’t include any currency symbols, such as $ or €.
- Boolean: A true or false value. These variables can only contain the True, False, or Empty String global constants.
- Date, Date/Time: A specially formatted value that indicates a specific date, or a specific time on a specific date. See Valid Date and DataTimes Formats for info on how to format date and date/time data.
- Record: All of the values in a Salesforce record, are stored together in a single variable. Each value maintains its own data type, just like in a Salesforce record. The flow can retrieve or update each value individually.
Advantages of Flows -:
- Admin maintainability
- Built-In version control
- Custom components
- Collections variables
- User-friendly debugging
Disadvantages of Flows -:
- Learning curve (as a developer)
- Code is less complicated for some use cases
- Missing capabilities that code has:
- Partial DML Operations
Please follow this module for Hands-On Experience.