Jan 19
Understanding Flow Resources
Contents
-
What are Flow Resources
-
Variables: Temporary Storage for Your Flow
-
Collections: Working with Multiple Records
-
Constants: Values That Never Change
-
Formulas: Dynamic Calculations
-
Text Templates: Formatted Text with Merge Fields
-
Choices: Options for User Selection
-
Stages: Tracking Progress in Screen Flows
-
Choosing the Right Resource: Quick Reference
-
Best Practices for Using Resources
Introduction
You've learned which Flow type to use. You know which elements to add to make your Flow do what you need. You've built the structure of your automation. That's great - you're making real progress.
But here's where many Salesforce Admins hit a wall: "Where do I actually store the data my Flow is working with?"
That's where Flow Resources come in.
In my years teaching Flow to thousands of Salesforce Professionals, I've noticed something interesting. People get comfortable with Flow Types and Elements fairly quickly, but Resources? That's where things start to feel confusing. What's the difference between a Variable and a Collection? When do I need a Constant versus just typing a value directly? Why would I use a Formula Resource instead of a Formula Field on my object?
These questions all come down to understanding Flow Resources - the containers that hold and manage the data your Flow works with while it runs.
In this guide, we're breaking down all seven types of Flow Resources. I'll explain what each one does, when to use it, and give you practical examples. By the end, you'll understand exactly where your Flow's data lives and how to work with it effectively.
If you want to master Flow with hands-on practice and advanced techniques, check out the Salesforce Flow Masterclass. For now, let's build your foundational understanding of Flow Resources.
What Are Flow Resources?
Flow Resources are containers that store and manage data while your Flow runs. Think of them as your Flow's temporary workspace - a place where it keeps information it needs to complete its job.
Let me take you back to our coffee shop analogy one final time. When a customer orders a latte, the barista needs to remember several pieces of information while making it: the customer's name (to write on the cup), which type of milk they want, how many shots of espresso, whether they want any flavor syrups, and what size cup to use. The barista writes these details on the cup or order ticket - these notes are the "resources" that store information temporarily during the order-making process.
Flow Resources work exactly the same way. As your Flow runs, it needs to store information temporarily - the Account Name from a record you just retrieved, a calculation you just performed, a collection of Contacts you're planning to update, or a formatted email message you're about to send.
The Resource Manager
In Flow Builder, you create and manage Resources in the Manager tab. Click the Manager button in the toolbox (it looks like a folder icon), and you'll see all the Resources you've created for your current Flow, organized by type.
Resources exist only while your Flow runs. When the Flow completes its work, the Resources disappear. If you need to save data permanently, you use Elements (like Create Records or Update Records) to write that data to actual Salesforce records in your database.
Write your awesome label here.
How Resources Work with Elements
Elements and Resources work hand-in-hand throughout your Flow. Get Records retrieves data and stores it in a Variable or Collection. Decision Elements check conditions using data from Variables. Assignment Elements modify values stored in Variables. Create Records Elements use data from Variables to set field values. Screen Elements display information from Variables to users.
Without Resources, Elements have nowhere to put the data they work with. Without Elements, Resources just sit there unused. They need each other to make your automation work.
Why Flow Resources Matter
Understanding Resources is essential because they're how your Flow "remembers" things as it runs. Every time your Flow needs to store a value, perform a calculation, or work with data across multiple elements, you're using Resources.
Common mistakes I see from admins learning Flow:
Mistake 1: Not checking if Get Records returned any records before trying to use the data, causing null reference errors.
Mistake 2: Creating separate Variables (varContact1, varContact2, varContact3) instead of one Collection that can hold all Contacts together.
Mistake 3: Hardcoding values in multiple places instead of using a Constant. When that value changes, you have to hunt down and update ten locations instead of changing it once.
Mistake 4: Creating Variables without default values and then using them before assigning any value. If you create varCounter and immediately try to use it in a formula like {!varCounter} + 1, your Flow errors because there's no value to add to. Solution: Set a default value when creating the Variable, or use Assignment to give it a value first.
Once you understand what each Resource type does and when to use it, these mistakes become obvious and easy to avoid.
Resource Selection Framework
When building a Flow, ask yourself: "What kind of data do I need to store?"
- Store a single value? → Variable
- Store multiple records? → Collection Variable
- Fixed value that never changes? → Constant
- Calculate something dynamically? → Formula
- Formatted text with data? → Text Template
- User selection options? → Choice
- Track progress through screens? → Stage
Variables: Temporary Storage for Your Flow
Variables are the most fundamental and commonly used Resource type. A Variable stores a single piece of data while your Flow runs - text, a number, a date, or even an entire record with all its fields.
What Variables Do
Think of a Variable as a labeled box. You put a value in the box, give the box a clear name, and reference that name whenever you need the value. The box exists only while your Flow runs - when the Flow finishes, the box disappears.
What Variables Do
When you add certain Elements like Get Records, Salesforce gives you options for how to create and store the data:
- Automatically store all fields - Salesforce creates a Variable containing the entire record with access to every field
- Choose fields and let Salesforce do the rest - You select which fields you need and Salesforce creates a Variable with just those fields (better performance)
- Choose fields and assign variables (advanced) - You manually create Variables beforehand and explicitly map which field goes into which Variable (maximum control)
For most Flows, option 1 or 2 works perfectly. Option 3 is for advanced scenarios where you need precise control over Variable creation.
Write your awesome label here.
Variable Data Types
When creating a Variable manually, you must select its Data Type - this tells Salesforce what kind of information the Variable will hold:
- Text - Any text value (letters, numbers, special characters)
- Number - Numeric values (specify decimal places)
- Currency - Monetary values with your org's currency settings
- Date - Just a date (no time)
- Date/Time - Both date and time
- Boolean - True or False (use {!$GlobalConstant.True} or {!$GlobalConstant.False})
- Record - An entire record (must specify which object)
Once set, you can only store that specific type of data in that Variable.
Important: A Record Variable is still a Variable – it just stores an entire record instead of a single value. You reference fields using {!varAccount.Name} just like $Record
Write your awesome label here.
When to Use Variables
You'll use Variables when storing results from Get Records (single record), holding calculated values from Formulas, passing data between Elements, storing user input from Screens, or building values that will populate fields in Create/Update Records.
Real-World Example
Your Flow retrieves an Account record using Get Records and stores it in a Variable called varAccount. Later, you send an email that includes the Account Name in the subject line by referencing {!varAccount.Name}. You also use a Decision Element to check {!varAccount.Type} and take different actions for "Customer" versus "Prospect". One Variable, used multiple times throughout your Flow.
Important Considerations
Starting Values: Variables start empty (null) unless you give them a default value. Always check if a Variable has a value before using it - use a Decision Element to verify it's not null, especially after Get Records operations that might not find any records.
Naming Conventions: Use clear, descriptive names with prefixes. Examples: varAccountName, varTotalAmount, varCustomerEmail. Avoid vague names like var1 or temp.
Availability Settings: Variables have two checkbox settings - "Available for Input" (allows values to be passed INTO your Flow when it starts) and "Available for Output" (allows values to be accessed FROM your Flow after it completes). For most Variables, leave both unchecked. Only use these for Subflows or parameterized Screen Flows.
Naming Conventions: Use clear, descriptive names with prefixes. Examples: varAccountName, varTotalAmount, varCustomerEmail. Avoid vague names like var1 or temp.
Availability Settings: Variables have two checkbox settings - "Available for Input" (allows values to be passed INTO your Flow when it starts) and "Available for Output" (allows values to be accessed FROM your Flow after it completes). For most Variables, leave both unchecked. Only use these for Subflows or parameterized Screen Flows.
Collections: Working with Multiple Records
Collections are Variables that can hold multiple values instead of just one. Think of a Collection as a box that can hold many items at once.
What Collections Do
A Collection stores multiple values of the same type. Most commonly, you'll use Collections to store multiple records - all Contacts on an Account, Cases to update, Opportunity Products to create, or Tasks assigned to a user.
When to Use Collections
You'll use Collection Variables when Get Records retrieves multiple records, you need to Loop through records, you're building a list of records to Create or Update in bulk, you're storing multiple user selections from Screens, or you're working with related records on a parent.
Real-World Example
Your Flow updates mailing addresses for all Contacts on an Account when the Account's billing address changes. Get Records retrieves all Contacts where AccountId equals your Account's ID, storing results in colContacts. You Loop through this Collection, use Assignment to update each Contact's mailing address fields, and add them to colContactsToUpdate. After the Loop, one Update Records Element with colContactsToUpdate saves all changes at once.
The Collection Processing Pattern
This is one of the most important patterns in Flow:
- Get Records stores multiple records in a Collection
- Loop through the Collection to process each record
- Inside the Loop, use Assignment to modify records and add to a new Collection
- After the Loop, use one Create/Update Records Element with the new Collection
Note: The Transform Element can sometimes replace this pattern when you're doing simple data mapping without conditional logic. But when you need to check conditions or apply different logic to different records, the Loop → Assignment → DML pattern is essential.
Common Pitfall
Never update the Loop variable directly and expect changes to persist. Always assign the modified record to a separate Collection used for DML after the loop.
Collections vs. Multiple Variables
Never create varContact1, varContact2, varContact3. Always use one Collection Variable. Collections handle any number of items automatically - you don't need to know the count in advance. Plus, you can Loop through a Collection to process each item. You can't Loop through separate Variables.
Important Considerations
Empty Collections: Collections can be empty (contain zero items). Before Looping, use a Decision to check if the Collection is null or has zero items. Otherwise, your Flow might error.
Collection Configuration: When creating a Collection Variable, select the same Data Type as a regular Variable, but check the "Allow multiple values (collection)" checkbox.
Write your awesome label here.
Constants: Values That Never Change
Constants store fixed values that don't change during Flow execution. Once you set a Constant's value, it stays the same every single time the Flow runs.
What Constants Do
Think of a Constant as a value written in permanent marker instead of pencil. You can read it anytime, but you can't change it. Constants are perfect for values used repeatedly that should always stay the same - standard processing fees, maximum discount percentages, default priorities, notification email addresses, or tax rates.
When to Use Constants
You'll use Constants when the same fixed value appears in multiple places in your Flow, you want to avoid "magic numbers" scattered throughout, the value might need to change in the future (update once instead of hunting through your entire Flow), or you're following best practices for maintainable Flows.
Real-World Example
Your company charges a standard $50 processing fee on all orders. Instead of typing "50" into five different elements, you create a Constant called conProcessingFee (Data Type: Currency, Value: 50). Whenever you need the processing fee, you reference {!conProcessingFee}. Six months later, the fee changes to $75. You update the Constant once, and all five references automatically use $75.
Why Use Constants Instead of Hardcoding?
Maintenance: Update one Constant instead of searching through your Flow to find every hardcoded value.
Clarity: Reading {!conProcessingFee} in a formula makes it clear what that number represents. Seeing "50" leaves people wondering what it means.
Consistency: Using a Constant guarantees the exact same value everywhere. Hardcoding means you might accidentally type "50" in one place and "500" in another.
Clarity: Reading {!conProcessingFee} in a formula makes it clear what that number represents. Seeing "50" leaves people wondering what it means.
Consistency: Using a Constant guarantees the exact same value everywhere. Hardcoding means you might accidentally type "50" in one place and "500" in another.
Important Considerations
Constants vs. Variables: Variables change their values while your Flow runs. Constants cannot change - they're fixed for the entire Flow run and across all Flow runs. If you need a value that starts at one amount and gets modified as your Flow executes (like a running total), use a Variable, not a Constant.
Formulas: Dynamic Calculations
Formula Resources calculate values dynamically based on other Resources, record fields, and built-in functions. They work like spreadsheet formulas - they evaluate every time you reference them, using current values at that moment.
What Formulas Do
Formulas perform calculations and transformations without needing Assignment Elements to build up values step by step. You define the calculation once, and whenever you reference the Formula, it calculates the result using current values. Formulas can perform math, manipulate text, work with dates, check conditions with IF statements, and call built-in functions.
When to Use Formulas
You'll use Formula Resources when calculating values dynamically, combining or transforming text, performing date calculations, implementing conditional logic that returns a value, or avoiding multiple Assignment Elements to build up values.
Formula Functions Overview
Formulas support built-in functions for text manipulation (UPPER, LOWER, CONTAINS), date calculations (TODAY, ADDMONTHS), math operations (ROUND, ABS), and logical operations (IF, AND, OR, ISBLANK). You can find the complete function reference in Salesforce documentation.
Formula Examples
Full Name: {!Contact.FirstName} & " " & {!Contact.LastName}
Default Value if Blank: IF(ISBLANK({!Account.Phone}), "No phone provided", {!Account.Phone})
Days Until Close: {!Opportunity.CloseDate} - TODAY()
Commission Calculation: {!Opportunity.Amount} * 0.15
Default Value if Blank: IF(ISBLANK({!Account.Phone}), "No phone provided", {!Account.Phone})
Days Until Close: {!Opportunity.CloseDate} - TODAY()
Commission Calculation: {!Opportunity.Amount} * 0.15
Real-World Example
Your Flow sends personalized emails to Contacts. Instead of using multiple Assignment Elements to build the greeting, you create a Formula called forGreeting: "Hello " & {!$Record.FirstName} & " " & {!$Record.LastName} & ",". Now {!forGreeting} automatically evaluates to "Hello Sarah Johnson," using the current Contact's name.
Important Considerations
Formula Resources vs. Formula Fields: Formula Resources exist only in your Flow and calculate during Flow execution. Formula Fields exist on objects and calculate when viewing records. Use Formula Resources when the calculation is specific to your Flow's logic.
Null Values: If fields used in your Formula are blank (null), the Formula might return unexpected results. Use ISBLANK() or ISNULL() to check for null values and provide defaults.
Null Values: If fields used in your Formula are blank (null), the Formula might return unexpected results. Use ISBLANK() or ISNULL() to check for null values and provide defaults.
Write your awesome label here.
Text Templates: Formatted Text with Merge Fields
Text Templates store blocks of text that include merge fields - placeholders that automatically fill with current data from your Flow. They're perfect for email bodies, screen messages, or any formatted text that includes dynamic information.
What Text Templates Do
Text Templates let you write your complete message once, embedding merge fields (references to Variables, Formulas, or record fields) directly in the text. When your Flow uses the Text Template, all merge fields automatically populate with current values. You can create Text Templates in Plain Text (simple unformatted text) or Rich Text (formatted with bold, italics, colors, bullet points, hyperlinks).
When to Use Text Templates
You'll use Text Templates when creating email bodies with dynamic content, building confirmation messages for Screen Flows, formatting notifications with multiple data points, or creating standardized messages used throughout your Flow.
Merge Field Syntax
Reference any Resource or field using: {!ResourceName} or {!RecordVariable.FieldName}
Examples: {!varAccountName}, {!$Record.FirstName}, {!forTotalAmount}, {!$Organization.Name}
Real-World Example
Your Flow sends order confirmation emails. You create a Text Template called txtOrderConfirmation that says:
"Dear {!Contact.FirstName},
Thank you for your order #{!Order.OrderNumber}.
Your total is ${!Order.TotalAmount}.
Estimated delivery: {!Order.EstimatedDeliveryDate}."
All merge fields automatically fill with actual current values when the email sends.
Important Considerations
Plain Text vs. Rich Text: Use Plain Text for simple messages where formatting doesn't matter. Use Rich Text when visual formatting improves clarity - like customer-facing emails or detailed screen instructions.
Null Values: If a merge field references an empty value, it displays as blank. To provide default text, use Formula Resources with IF(ISBLANK()) logic instead of directly referencing potentially empty fields.
Choices: Options for User Selection
Choices provide selection options for Screen Flow components like Radio Buttons, Picklists, Checkboxes, and Multi-Select Picklists. They define what options users can choose from.
What Choices Do
Choices provide selection options for Screen Flow components like Radio Buttons, Picklists, Checkboxes, and Multi-Select Picklists. They define what options users can choose from.
What Choices Do
Choices create selectable options in Screen Flows. Instead of hardcoding options directly into Screen components, you create Choice Resources that can be reused and updated easily.
There are several types of Choices:
- Choice (single) - One individual option with a label and value
- Picklist Choice Set - Multiple choices pulled from an existing picklist field on an object
- Record Choice Set - Multiple choices pulled from actual Salesforce records (like a list of Accounts or Products)
- Collection Choice Set - Multiple choices created from a Collection Variable you've already built in your Flow
When to Use Choices
You'll use Choice Resources when building Radio Buttons, Picklists, Multi-Select Picklists, or Checkbox Groups in Screen Flows, or whenever you need to give users predefined options to select from.
Real-World Example
Your Screen Flow asks users to select a priority level for a new Case they're creating. You create three individual Choice Resources:
Choice: choicePriorityHigh
Label: "High - Urgent attention needed"
Value: "High"
Choice: choicePriorityMedium
Label: "Medium - Standard response time"
Value: "Medium"
Choice: choicePriorityLow
Label: "Low - When time permits"
Value: "Low"
You add these three Choices to a Radio Buttons component in your Screen. Users see the descriptive labels that help them understand each option, but when they select one, your Flow stores the simple value ("High", "Medium", or "Low") that matches your Case Priority field values.
Important Considerations
Choice Labels vs. Values: Labels are what users see (can be long and descriptive). Values are what your Flow stores (usually short and matching field values). Make labels user-friendly and values system-friendly.
Picklist Choice Sets Stay in Sync: Picklist Choice Sets automatically synchronize with picklist field values. If someone adds a new picklist value, it immediately appears in your Choice Set without Flow changes
Write your awesome label here.
Stages: Tracking Progress in Screen Flows
Stages represent steps in a multi-screen Flow, showing users their progress as they move through your process. Stages work with the Progress Indicator component to create a visual progress bar.
What Stages Do
Stages are purely visual - they don't control Flow logic or execution. Each Stage represents one step. As users complete screens, you update which Stage is "active" using Assignment Elements, and the Progress Indicator automatically shows their current position. Stages work by assigning a Stage resource to the global variable {!$Flow.CurrentStage}
When to Use Stages
Use Stages when building multi-step wizards in Screen Flows, users need visual feedback about their progress, your process has clearly defined sequential steps, or you want to reduce user uncertainty about "how much longer?"
Real-World Example
Your onboarding Screen Flow has four steps. You create four Stages: stagePersonalInfo (Order: 1), stageEmergency (Order: 2), stageBenefits (Order: 3), stageReview (Order: 4). As users complete each screen, Assignment Elements update {!$Flow.CurrentStage} to the next Stage. The Progress Indicator automatically updates, showing "Step 2 of 4.
Important Considerations
Stages Are Optional: Not every Screen Flow needs Stages. Use them for multi-step processes where visual progress helps users. Skip them for simple one or two-screen Flows.
Order Matters: The Order field determines display sequence. Number Stages starting at 1 with no gaps (1, 2, 3, 4).
Choosing the Right Resource: Quick Reference
Write your awesome label here.
Best Practices for Using Resources
Use Consistent Naming Conventions
Use consistent prefixes to identify Resource types at a glance:
Be descriptive, not cryptic: varSelectedAccountId tells future you (and other admins) exactly what it contains. var1 tells you nothing and forces someone to trace through your entire Flow to figure out what it is.
Use consistent casing: Pick camelCase (like varAccountName) or under_scores (like var_account_name) and stick with it throughout all your Flows. Consistency makes Flows easier to read and maintain.
- Variables: var prefix - Examples: varAccountName, varTotalAmount, varSelectedContact
- Collections: col prefix - Examples: colContacts, colOpenCases, colProductsToCreate
- Constants: con prefix - Examples: conCommissionRate, conMaxDiscount, conDefaultPriority
- Formulas: for prefix - Examples: forFullName, forDaysUntilClose, forQualifiesForDiscount
- Text Templates: txt prefix - Examples: txtWelcomeEmail, txtOrderConfirmation
- Choices: choice prefix - Examples: choicePriorityHigh, choiceAccounts, choiceDepartments
- Stages: stage prefix - Examples: stagePersonalInfo, stageReview, stageSubmit
Be descriptive, not cryptic: varSelectedAccountId tells future you (and other admins) exactly what it contains. var1 tells you nothing and forces someone to trace through your entire Flow to figure out what it is.
Use consistent casing: Pick camelCase (like varAccountName) or under_scores (like var_account_name) and stick with it throughout all your Flows. Consistency makes Flows easier to read and maintain.
Write your awesome label here.
Initialize Variables When Possible
Variables start null unless you set a default value. If you know a Variable should start with a specific value (like a counter starting at 0), set it when creating the Resource rather than using an Assignment Element later.
Use Constants for Repeated Values
If the same value appears more than twice in your Flow, make it a Constant. This applies to standard fees, rates, email addresses, default statuses, threshold values, and any value that might change in the future.
Always Check for Null Values
Test your Flows with missing data. After Get Records, check if the result Variable Is Null. Before Looping through a Collection, check if it's null or has zero items. Before using fields in Formulas, check if they're blank with ISBLANK(). Null-checking prevents errors and makes your Flows robust.
Clean Up Unused Resources
Before activating your Flow, delete Resources you created but didn't use. Unused Resources clutter your Flow, make it harder to understand, and confuse other admins reviewing your work.
Ready to Master Flow Resources?
Understanding what Resources are and when to use each type is one thing. Building Flows that use Resources effectively - choosing the right type, naming them clearly, initializing them properly, and combining them with Elements to create robust automation - that's where real mastery lives.
In the Salesforce Flow Masterclass, you'll build real Flows that use Variables, Collections, Formulas, and Text Templates in practical business scenarios. I'll show you how to design Resource architecture, avoid common mistakes, implement advanced patterns, and debug when Resources don't behave as expected.
Enroll in the Flow Masterclass → Flow Masterclass
Stop guessing which Resource to create. Build Flows that handle data like a pro.
In the Salesforce Flow Masterclass, you'll build real Flows that use Variables, Collections, Formulas, and Text Templates in practical business scenarios. I'll show you how to design Resource architecture, avoid common mistakes, implement advanced patterns, and debug when Resources don't behave as expected.
Enroll in the Flow Masterclass → Flow Masterclass
Stop guessing which Resource to create. Build Flows that handle data like a pro.
Summary: Key Takeaways
-
Flow Resources store and manage data while your Flow runs - they're your Flow's temporary workspace and memory
-
Seven Resource types serve different purposes: Variables (single values), Collections (multiple values), Constants (fixed values), Formulas (calculations), Text Templates (formatted text), Choices (selection options), Stages (progress tracking)
-
Variables store single values temporarily - one Account, one calculation result, one piece of text that you need while your Flow runs
-
Salesforce gives you options for how to store data from Elements - automatically store all fields, choose specific fields, or manually create and assign Variables
-
Collections store multiple values of the same type - essential for working with related records and processing data efficiently using the Loop → Assignment → DML pattern
-
Constants store fixed values that never change - use them for any value you reference more than twice to improve maintainability
-
Formulas calculate dynamically using Resources, fields, and functions - perfect for math, text manipulation, date calculations, and conditional logic
-
Text Templates create formatted messages with merge fields that automatically populate with current data - ideal for emails and screen messages
-
Choices provide selection options for Screen Flow components like Radio Buttons and Picklists
-
Stages track user progress through multi-step Screen Flows with visual progress indicators
-
Always use naming conventions with prefixes and descriptive names - makes Flows readable and maintainable
-
Check for null values before using Variables and Collections - prevents Flow errors from empty data
-
Use Constants for repeated values instead of hardcoding - makes maintenance infinitely easier
Next in the series: You now understand Flow Types (when), Flow Elements (what), and Flow Resources (where data lives). You have all the foundational knowledge. In the next articles, we'll put everything together and build complete Flows from start to finish, walking through real-world scenarios step by step.
Copyright © 2025
Company
-
About
-
Careers
-
Team
-
Contact
Legal
-
Privacy Policy
-
Terms of Use
-
Cookie Policy