0% found this document useful (0 votes)
108 views

Salesforce Flow Quick Reference Guide

This document provides a quick reference for Salesforce Flows. It describes the different types of flows including screen, record-triggered, scheduled, and platform event-triggered flows. It also outlines the configuration options for record-triggered flows. Additionally, it defines the types of resources that can be used in flows like variables, constants, and records. It describes common elements in flows for creating and updating records.

Uploaded by

Suresh Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views

Salesforce Flow Quick Reference Guide

This document provides a quick reference for Salesforce Flows. It describes the different types of flows including screen, record-triggered, scheduled, and platform event-triggered flows. It also outlines the configuration options for record-triggered flows. Additionally, it defines the types of resources that can be used in flows like variables, constants, and records. It describes common elements in flows for creating and updating records.

Uploaded by

Suresh Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Salesforce Flow Quick Reference by Gradient Works

Flow Types the record is updated to meet the specified criteria (e.g.
Only run when an Opportunity StageName is updated to
● Formula - Computes a value using a formula, just like a
formula field. Use merge fields to refer to other Resources
When creating a Flow you’ll be prompted to choose a type to “Closed/Won”) from the Flow.
determine how the Flow executes. ● Optimizations - If you plan to use the Flow to do ● Text Template - Create a template using merge fields with
calculations using just the fields in $Record or optional formatting. Great for email bodies.
● Autolaunched (No-Trigger) - Called by Process Builder,
$Record__Prior and then update fields on $Record without
another Flow or Apex code. No UI capability.
accessing anything else, use “Fast Field Updates”. Choice Types (Screen Flows Only)
● Screen - Runs insides Salesforce Lightning experience and
Otherwise, use “Actions and Related Records”. Used by UI components like picklists to display a list of options
provides a user interface. Can be executed by UI
● Scheduled Paths - Sometimes, you need to execute some to the user. Choices have a label that’s displayed to the user for
components like buttons.
steps after a certain amount of time has elapsed (e.g., each option and a value that’s stored in the Choice Resource
● Record-Triggered - Runs when a record is created,
update a Lead after some external service has enriched it) once the user makes a selection.
updated or deleted. No UI capability.
or at some relative time in the future (e.g., 24 hours before
● Schedule-Triggered - Runs on a predefined schedule. No ● Choice - Manually specify options.
this Task is due). Scheduled paths allow you to do just that.
UI capability. ● Record Choice Set - Provide options from a list of records
● Platform Event-Triggered - Available in Enterprise Edition (e.g. a list of Contacts related to an Account)
and up. Runs when a Platform Event is delivered. No UI Resources ● Picklist Choice Set - Provide options from a Picklist field on
capability. an existing Object (e.g. Opportunity stages)
Resources store data. They’re a little like custom fields used by
the Flow. Like a field, you need to give Salesforce some info
Record-Triggered Flow Config about what you want. Data Types
Record-Triggered Flows run whenever data changes and require Data Types are used in various ways to tell Salesforce what kind
extra configuration to define their starting conditions and Resource Types of data a Resource will contain.
execution paths. Each Flow relates to a single Object type. The
The Resource Type controls how a Resource can be used. Data ● Text - Any characters, numbers, etc. No size limit.
record which triggered the flow is available as a resource called
Types control what a Resource can contain. ● Record - A record from a specific Object. You’ll need to
$Record. Below are other configuration options:
specify the Object type as well. (e.g. Lead, Account)
● When - Choose created; updated; created or updated; or Available to All Flow Types ● Number - A numeric value with a certain number of decimal
deleted. If you choose “created or updated”, you will have ● Variables - Holds a value that you can set in your Flow and places.
access to both $Record and $Record__Prior which contains then retrieve later. ● Currency - Similar to Number but for money.
the state of the record before the changes that triggered ● Constant - Set this value once and it doesn’t change. ● Boolean - Contains true or false. When setting Boolean
the Flow. Useful for “hardcoded” values that might need to change, resources, use $GlobalConstant.True or
● Entry conditions - Specify specific conditions a record like the name of a record type. $GlobalConstant.False.
must meet to trigger the Flow. For Flows triggering on ● Date - A day without a time value.
updates, you can also choose to run the Flow only when ● Date/Time - Both a date and time.
Salesforce Flow Quick Reference by Gradient Works • Page 1
● Apex-Defined - An instance of an Apex Class. You’ll need ● Action - Actions allow you to reuse logic provided by Create Records
to specify the Apex Class as well. The Apex Class is similar someone else. Salesforce provides built-in actions for
You can create one or more records of a specific Object type
to a Custom Object and the Resource is similar to a Record things like sending an email. You can build your own using
using this Element. The behavior differs if you’re creating one or
from that Custom Object. Apex or use certain managed packages that provide
multiple:
Actions. (e.g. Gradient Works provides actions to perform
Additional Variable Config round-robin assignments or lead matching.) ● One - You can choose to save a single Record Resource to
Variables have some extra options that control how they can be ● Subflow - Execute another Flow from the current Flow. set Record fields, but the most common option is to set
used inside and outside the Flow. Combine this with Input and Output variables to create specific field values using separate Resources. When
Flows you can reuse from multiple places. creating one record, this Element provides an output that
● Allow multiple values (collection) - Flow variables hold contains the Id of the newly created record.
either a single value of a given Data Type (e.g. the text ● Multiple - Specify a Record Collection Variable that
“Foo”) or a collection (aka a list) of values (e.g. “Foo”, “Bar”,
Logic
contains the unsaved Records to create. After this Element
“Baz”). Collections are especially useful for holding multiple ● Assignment - Set the value of a Variable Resource or a executes, all records will have ids assigned.
records. field on a Record Resource. You can perform multiple
● Availability Outside the Flow - Variable Resources may be assignments in a single Assignment action. Update Records
used as “Inputs” provided to the Flow by some other ● Decision - Choose one or more Outcomes (execution
Use this Element to ensure records you’ve previously created or
process (e.g. another Flow, Process Builder or a UI action). paths) for the Flow to execute based on specific criteria.
modified in the Flow are saved. It also provides a mode to set
They may also be provided by the Flow as “outputs” (e.g. ● Loop - Loops allow you to run some Elements for each item
fields on records “in place” without first loading them into the
one Flow may use a Subflow Action to have a 2nd flow in a Collection Variable. Think of Loops as a special kind of
Flow via Get Records.
compute a value). Decision that checks to see if you’ve processed all items in
the Collection. If you haven’t, the Outcome is to run through ● Use a Record or Record Collection - Specify the Record or
the same Elements again. Once you have, go on to the next Record Collection Resource you want to update. Any field
Elements Elements. values those Records contain will be saved.
Flow Elements control what the Flow does and in what order. ● Collection Sort - Sorts the items within a Collection. If ● Use Conditions to Set Fields - Perform an update without
You connect elements to each other to describe a series of those items are Records, choose which fields to use for loading the records first. This updates any records in
steps that build on each other — the outputs of one step can be sorting. You can also use this to truncate a collection to a Salesforce that match the specified conditions, setting their
used as inputs to another step. This allows you to create certain number of items. fields to the specified values. Be careful.
complex “programming” without using code. There are three ● End - Does just what you think it does; ends the Flow right
major categories of Elements: Interactions, Logic and Data. then and there. Get Records
Use this Element to retrieve one or more records based on

Interactions Data specific criteria. You can choose to store “Only the first record”
or “All records”. Depending on your choice, you can refer to the
● Screen - Build a fully interactive UI in Lightning Experience. There are four Data Elements: create, update, get and delete. Element API name later to access a single Record or a Record
Use this Element to create forms to capture data or screens These are the most complicated Elements and have various Collection, respectively. If you only get the first record, be sure
to display it. options to support different use cases. to set the Sort Order if there’s the possibility more than one
record might match your criteria.

Salesforce Flow Quick Reference by Gradient Works • Page 2


After specifying what records to retrieve, you specify how to
Use Naming Conventions Use Versions and Comments
store the record fields in the Flow so other Elements can work
with the data: Flows require you to name lots of different things. Resources, Flows support versioning. Use them and provide comments
Elements and Outcomes require a label and an API Name. Here with each version. When you get a chunk of functionality
● Automatically - Use this most of the time. The Flow keeps are some opinions about how you should name things. Do what working or before making a big change, save a version and
track of any fields you access in the Flow and ensures you want, but whatever you do, just be consistent. Your future describe what you’ve changed. That way you can quickly find a
those are loaded and available. self will thank you. change later and even revert back if necessary.
● Choose fields - This gives you power over which fields are
loaded. This can be useful in situations where you’re ● Use Snake_Case for API Names - Name all your Resources
dealing with a lot of records, you know exactly what data and Elements using capital first letters and underscores to Use Element Descriptions
you need and you need to be super-efficient. separate words. Every Element has a description text area right under the label
● Choose fields and assign variables - This is similar to ● Use nouns for Resources - Resources represent “things” and API name fields. You should make sure your Elements have
choosing fields above but lets you also store the results in a you use to access data or hold data; it only makes sense to clear and concise names but sometimes you need to explain
Variable Resource at the same time. name “things” with nouns. things a little further. Use this description field to provide
● Use verbs for Elements - Elements represent actions the additional commentary about what a particular Element does.
Delete Records Flow takes. Give them active names that use verbs to
describe what you’re doing (e.g. “Get Lead”, “Assign
Use this element to remove records entirely. Use extreme
Stage”). Exceptions are Decisions and Loops.
Don’t Hardcode
caution because deleting stuff is always dangerous. Similar to
● Use questions for Decisions - Frame decisions as a It’s tempting to copy specific values like a User id or record type
Update Records, you can delete records in a Variable Resource
question (e.g. “Is Open”) and your Outcomes as answers to id directly into your Flow. Try to avoid this. Have a special user?
or you can delete “in place”.
that question (“True”, “False”). This also applies to Use Get Records to look up the user record and then use that
● Use a Record or Record Collection - Specify the Record non-binary Decisions (e.g. “Which Territory” with outcomes Id. This is way more portable if you move Flows from Sandbox
you want to delete or the Record Collection Resource for North, South, East, etc). to Production and vice-versa. If you must hardcode something,
containing records you want to delete. ● Use prefixes for Outcomes - Each non-default Outcome in consider using a Constant Resource with a sensible name. That
● Use Conditions - Perform a delete without loading the a Decision has its own API name. To make it easier to find, way you’ll know what the hardcoded value means later.
records first. This deletes any records in Salesforce that prefix it with the API name of its decision (e.g.
match the specified conditions. Be very, very careful. “Is_Open_True” for the True Outcome API name of the
“Is_Open” decision).
Use Auto-Layout
● Use Each for Loops - Loops let you do something with Auto-Layout automatically positions Flow Elements relative to
Best Practices each item in a Collection, one-by-one. If you’re looping over each other to create a vertical layout that shows how the Flow
a Collection of Users, name your Loop “Each User”. For executes from to-to-bottom. If you turn off Auto-Layout, you’ll
Below are some opinions about how to consistently build high
Elements inside the Loop, you can refer to “Each_User” to be responsible for positioning each element — this is sometimes
quality, maintainable Flows. These are just like, our opinion man,
access the current item. good but usually more of a pain than it’s worth.
but we’ve seen them work in real life.

Salesforce Flow Quick Reference by Gradient Works • Page 3


Common Issues
Accessing the “Current Record”
When building a screen Flow to be used on a record detail page
(via a button or otherwise), Salesforce expects the Flow to have
a Text Variable called “recordId” that it will set with the id of the
record the user is viewing. This variable must be flagged as
available for input or this won’t work.

Exceeding DML Limits


One common source of exceeding limits is using data elements
to create/update/get/delete inside a Loop element. Don’t do
this. Instead, put all the records you need to save in a Collection
Variable for a single bulk update/create after the loop
completes.

If you’re not using Data Elements within a Loop but are still
seeing DML limit issues from a Record-Triggered Flow, your
Flow is probably running for too large of a batch during a data
import. Consider either a) reducing the batch size in Data
Loader or b) using a Scheduled Path which allows you to control
the batch size from within the Flow.

Finally, make sure you’re using as few Data elements as possible


and not querying for things you don’t need.

Calculating Relative Dates/Times


If you need to set a value with a relative date like “30 days from
today” or get records created in the “last 24 hours”, create a
Date or Date/Time Formula Resource that uses Date or
Date/Time math — just like in a Formula field. Then, use that
Formula Resource in your Element.

Salesforce Flow Quick Reference by Gradient Works • Page 4

You might also like