Flow Builder
These are technical notes I compiled while studying using Trailhead, Salesforce's free self-learning portal.
Learn About Flow Resources and Variables
List the resources available in Flow Builder. Describe what a flow variable is.- In flows, Resources are placeholders similar to merge fields in an email template or formula.
- Ex: starting an email with “Hi {!User.FirstName}”, so that when it is sent it displays the actual first name of the user.
- Basic kinds of flow resources:
- Constant: fixed value
- Choice, Picklist Choice Set, or Record Choice Set: represent an option in a screen component
- Choice sets generate choices for you by using a filtered list of records or the values of a picklist (or multi-select picklist) in your org
- Variables: placeholders for values that aren’t known yet
- Create variables when a vlaue can differ based on certain conditions. For example, when the value depends on which record the flow operates on or the result of some logic in the flow.
- We can’t reference a field from Salesforce records directly, so the field needs to be stored in a flow using a variable.
- A choice set can generate options with: Filtered records or Picklist field values
- A variable: stores a value that you can change in the flow
Create a Variable
Create a flow variable. Define input and output variables.- Many types of data can be stored in variables:
- Text: IDs, descriptions, text or long text data
- Record: Field values from a record
- Number, Currency, Boolean, Date, Date/Time, Picklist, Multi-Select Picklist, Apex-Defined
- By default, variables store one value. If multiple values need to be stored, enable it with the “Allow Multiple Values” checkbox, which turns the variable into a collection variable.
- Variables can get their value from inside or outside the flow:
- If a flow is distributed on an Account record page, you can pass the account’s ID into the flow using the flow’s input variables.
- If whatever starts the flow should be able to set the value of a variable, need to make sure the variable is “Available for Input” using the “Available for Input” checkbox
- When in doubt, make the variable available for input
- Available for Output means the variable is accessible to something outside the flow using the “Available for Output” checkbox
- When in doubt, don’t make the variable available for output
- If a flow is distributed on an Account record page, you can pass the account’s ID into the flow using the flow’s input variables.
- Create a Text variable to store: Descriptions, Long Text data
- When in doubt, you should configure a variable to be: Available for input, not available for output
Add Screens to Your Flow
List the types of components you can add to screens. Add a confirmation screen to a flow.- Three categories of screen components:
- Input: request info from user
- Display: display info to user
- Custom: include components you or someone else created (from AppExchange or a developer)
- Radio buttons, picklists, checkbox groups, and multi-select picklist components require a choice or choice set resource to identify the options. Choice resources should be used as last resort.
- Record choice set: generates options by using a filtered list of records
- Picklist choice set: generates options by using values of a picklist or multi-select picklist
- Choice: represents a single option with label and value set manually
- Flows have two runtime experiences: Lightning runtime (looks like Lightning Experience) and Classic runtime (looks like Visualforce). Use Lightning runtime.
Add Logic to Your Flow
List the logic elements available in Flow Builder. Add branching logic to a flow. Change a variable value in a flow.- Rules determine actions in most business processes. Decision elements are used to evaluate the rules of business processes.
- Decisions answer a question and the outcomes provide the possible answers
- The first outcome that meets the conditions is the branch that is taken
- When checking a Boolean value, like a toggle or checkbox, use the global constants for true or false ({!$GlobalConstant.True, {!$GlobalConstant.False}}), not the word true or fales
- Assignment elements are used to change a variable’s value
- Loop and Pause are not covered in this module
Add Actions to Your Flow
List the actions available in Flow Builder. Understand when to use a record variable in a data element. Configure a Post to Chatter core action.- The power of a flow is that it can automatically do things for the user (update data, send emails, send info to an external system, with integration with Apex and local actions - anything else)
- Get Records elements specify which object to look up, how to filter the object’s records, and how to sort the filtered records.
- Update Records elements identify which elements to update and how to update them.
- Create Records elements create records
- To create multiple records, values from a record collection variable must be used
- For each record that’s created, the flow stores the ID of the created record in the ID fields of the record collection variable
- To specify values in the newly-created records, two options:
- Use values from the record variable(s)
- Manually map values from various resources in the flow. Can use a combination of variables, resources, and literal values.
- Action Element is one of the interaction elements. They include:
- Without additional configuration, following actions are available:
- Post to Chatter, Send Email, Submit for Approval, Activate/Deactivate a Permission Set, Global or object-specific actions
- Actions created with clicks:
- Other flows available in Subflow element
- Custom global or object-specific actions are available in the Action element
- Actions created with code:
- To do something in the Salesforce database, build or install an Apex action
- To do something in the browser, build or install a local action
- Without additional configuration, following actions are available: