3. Agenda
• Lightning flows overview
• Types of flows
• Lightning flows roadmap
• Flows vs Apex
• Demo
• Q & A
4. What is Salesforce Flows ?
● A Salesforce Flow is an automation that collects data and performs
actions in your Salesforce org or an external system
● Flow can fetch, delete, update and create records on multiple objects
● Declarative development tool
5. Types of Lightning Flows
There are two types of Lightning flows:
● Screen flow
○ can be used to automate a business process that collects data from people. For example,
a guided tutorial or wizard with screens
● Auto Launched Flow
○ can be used to launch a flow internally when a record changes or when a user clicks a
button. For example, perform an action to a record when a user updates or creates a
record.
7. Types of Auto-Launched Flows
● Record-Triggered Flow
○ are tied to an object. Whenever a record from that object changes, the flow kicks in and
allows you to make before-save changes to that record. This type of flow only supports
Assignment, Decision, Get Records, and Loop Elements.
● Scheduled Flow
○ These auto-launched flows launch at a specified time and frequency for each record in a
batch, and they run in the background
● Platform Event Flow
○ run when a Platform Event message is received.
8. Features Included In Flows
• User Interface
Element Screens
• Logic Elements
• Decision
• Assignment
• Loop
• DML Operations
• Email Alerts
• Quick Actions
• Apex Actions
• DML Operations
(Data)
• Create Record
• Update Record
• Get Record
• Delete Record
9. ● In a flow, a variable is a container that holds a piece of information.
● In a screen flow, store the ID of the record that the flow is displayed on, so
you can tell the flow which record to update at the end of the flow.
● Store a number value
Flow Variables
10. ● Plan out your flow before you start building
● Build your flows in a test environment—like a sandbox or Developer
Edition org.
● Never hard-code Salesforce IDs.
● Wait until the end of the flow to make changes to the database.
● Control when running users can navigate backward.
● Provide an error handler.
● Save early and often.
● Avoid accessing external objects after DML operations in a transaction.
Flows Best Practices
11. ● No DML Statement in Loops.
● Document your flows
● Build Reusable Flows and Sub-flows
Flows Best Practices (Continued..)
12. ● Apex code requires constant development and discipline to maintain.
Flows require less work to keep up-to-date.
● Flows can be built by admins, while Apex code is typically built by
developers only.
● Apex code is considered a tool of last resort. Flows are simpler and should
be used before Apex code.
● If the logic is too complex, Apex code should be used. There is unlimited
potential with Apex; flow capabilities are catching up, but they are still
inferior to Apex.
Flow vs Apex
13. ● You’re dealing with complex Salesforce automation that requires multiple
steps and actions where a flow will become cumbersome.
● You need custom-built integrations with other systems
● If a trigger is already in place.
When APEX code should be used instead of
flows in the following scenarios