This is a comprehensive dive into how to use Salesforce flows, when and when not to use them, and some super helpful tips and tricks around designing, development, testing, and deploying flows.
This was presented by Josh LeQuire at the Charleston, SC Salesforce admin group on 2/6/20.
2. Welcome to the Trailblazer Community
Let’s succeed together
LEARN
Get help, answers, and
inspiration from your peers
and Community Leaders.
CONNECT
Meet Trailblazers like you and
discover opportunities from
mentorship to employment.
HAVE FUN
Enjoy a warm, welcoming
culture and make friends
from around the world.
GIVE BACK
Inspire and mentor the next
generation while building
your skills and reputation.
2
3. Introduction - Josh LeQuire, theCodery.io
Josh theCodery - Deep, Onshore End-to-End Delivery Expertise
20+
Avg years of experience building
first-class business applications
7
Minimum years of experience working on
the Salesforce platform
6
Average number of certifications per
consultant
100+ Successfully delivered projects
50+ AppExchange-ready products developed
8 Clouds with deep expertise
Tim Osbon, MD, MS
In-house Medical and
Life Science Advisor
Adoption Focus
Quick, cost effective
agile implementation
expertise.
Delighted Clients: Past, Present, & Future
Healthcare &
Life Sciences
3
with Silverline
4. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
Topics & Agenda
● Before you flow….
○ When and when NOT to use a flow?
● What is a flow?
● Foundational concepts for flows
● Best (at at least better) practices with flows
● Use cases!
○ Creating service contracts from opportunities
Foundation to Application
4
5. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
Before you flow...
Flows are mini-applications. Do you know?
● What problem(s) are you trying to solve?
● What activities are involved? What is the
sequence?
● What data are involved?
● What kind of User Experience (UX) needs
to be considered?
● What design alternatives exist? Which is
the most optimal for your constraints,
performance, and scale? (More on this later…)
Stop, think, and apply best practices FIRST.
5
6. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
Platform Tools
“To a hammer, everything looks like a nail…”
6
Job Declarative Programmatic
Presentation Layer ● LEX pages, layouts
● Actions and publisher layouts
● Flow
● Lightning Components (Aura, LWC)
● VisualForce
Logic and Data
Manipulation
● Validation Rules
● Approval Processes
● Workflow
● Process Builder
○ (and Flow)
● Apex framework
○ Controllers
○ Triggers
○ Asynchronous
○ Etc
Security ● Profiles and Permissions
● Sharing and Sharing Rules
● Programmatic Sharing
Advantages ● Easier, quicker to implement
(deploy without tests, change
easily, activate, etc)
● Concept prototyping
● One off transactions
● Massively more efficient
● Scalable*
● Performant*
● Bulk transactions
● Highly flexible for UX and DML
needs
* when proper architecture design is applied
7. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.ioRapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
What is a flow?
Check out this fantastic trail mix!
(and another pretty good one too)
● Elements
○ Screens
○ Logic
○ Actions
○ Integrations
● Connectors
● Resources
○ Variables
Hint: it’s (mostly) declarative automation requiring no code.
7
8. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.ioRapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
Tips for Flows
1. Apply programming best practices.
a. Think “bulkify.”
i. Work inside lists.
ii. Minimize queries and DML calls as much as possible.
b. Use variables,, assignments, and loops heavily.
c. Beware of object level cascading effects.
i. Integrate appropriately with triggers, processes, workflow, jobs, etc.
2. Get creative with debugging.
3. Test thoroughly!
4. Integrate creatively with other platform tools.
a. Lightning pages
b. Process builder (headless)
c. Actions
d. Lightning Flow Scheduler (new)
e. Programmatic integrations
i. Invocable Apex
ii. Embedded Lightning Components
From the school of hard knocks.
8
9. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
Flowing Rapidly to a Solution
1. What final data do you need to create?
2. What inputs do you need? (user, from records)
3. How do you go from inputs to final outputs?
Set yourself up for success.
9
Define Data to
Generate
(outputs)
Identify Critical
Data Elements
(inputs & process)
Break down
Steps to Flow
Test DeployBuild
10. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.ioRapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
Company: TCIO Holistic Health
Offerings:
PRODUCT:
Home Health Tablet (iPad)
SERVICES:
Home Health Application Subscriptions
Ongoing Support
1 hour 1-on-1 Coaching Sessions
SIMPLE USE CASE
Creating Service Contracts from Won Opportunities
10
What needs to happen:
1. Client Manager creates service contract or
asset after an opportunity is won.
2. Line items from the opportunity should go onto
the service contract.
11. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
Simple Use Case: Data Elements to Consider
The Underlying Data Model
11
Account
Opportunity
Opportunity
Product
Service Contract
Service Contract
Line Item
Inputs
12. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.ioRapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
The Flow
Simple use case, works well for one off, when user initiated.
12
13. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.ioRapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
Company: TCIO Holistic Health
Offerings:
PRODUCT:
Home Health Tablet (iPad)
SERVICES:
Home Health Application Subscriptions
Ongoing Support
1 hour 1-on-1 Coaching Sessions
COMPLEX USE CASE
Creating Service Contracts and Assets from Won Opportunities
13
What needs to happen:
1. Client Manager creates service contract or
asset after an opportunity is won.
2. If an opportunity line item is:
a. a product, create an asset with its
entitlement for the customer
b. a service, create a service contract for all
service line items on the opportunity, with
related entitlements for the customer
(contract has line items from the
opportunity)
14. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
Complex Use Case: Data Elements to Consider
The Underlying Data Model
14
Account
Opportunity
Opportunity
Product
Service Contract
Service Contract
Line Item
Asset
Product
Entitlement
Template
Entitlement Entitlement
Inputs
15. Rapid Solution Delivery with Flows | Josh LeQuire | thecodery.ioRapid Solution Delivery with Flows | Josh LeQuire | thecodery.io
The Flow
It almost works (could with more debugging & time)… but not ideal.
15
Better designs:
1) LWC / aura component with
controller
2) Integrate invocable apex into
this flow
The ugly:
1) Flat single object queries, no
SOQL advantages
2) Can’t query records ‘in’ a list of
criteria (have to use 2+ for
loops)
3) MULTIPLE database calls you
could consolidate in Apex
4) Incredibly complex
5) Extremely difficult to debug,
test, and maintain - plenty of
unintended consequences