Intermediate 15 min read

Formulas and Variables in Flow

By the end of this lesson, you'll be able to:

  • Write a formula resource for use in Flow logic
  • Use variables to pass and store values through a Flow

Prerequisites: Before-Save vs. After-Save Flows

Formula resources

A Formula resource in Flow is defined once, using standard Salesforce formula syntax and referencing other Flow variables or record fields with merge field syntax ({!VariableName}), and can then be reused anywhere else in the Flow — decisions, assignments, screen text — without recalculating it in multiple places.

Variables

A Variable resource holds a single value of a declared data type (Text, Number, Boolean, Record, Collection) for use as the Flow runs — set via an Assignment element, read via merge field syntax anywhere downstream. Record and Collection variables specifically hold whole sObject records or lists of them, not just primitives.

A reusable Formula resource

Formula resource "Discounted_Total":
{!Var_Amount} - ({!Var_Amount} * {!Var_DiscountPercent} / 100)

Referenced later in a Screen element's display text:
Your total after discount is: {!Discounted_Total}

The Formula resource is calculated once and can be referenced by name ({!Discounted_Total}) wherever it's needed downstream — exactly like a formula field, but scoped to this one Flow.

Exercise

Write a Flow formula resource that computes a Number variable Var_Price's value with 15% VAT added.

Show hint

Multiply Var_Price by 1.15, or add Var_Price * 0.15 to itself.

TEXT

Formulas and Variables in Flow — Quick Check

1. What syntax does Flow use to reference a variable or formula resource elsewhere in the Flow?

2. A Formula resource in Flow is calculated once and can be reused wherever it is referenced.

3. What kind of Variable resource holds a whole sObject record?

Log in to submit the quiz and save your score.

My Notes

Log in to keep private notes on this lesson.

Questions about this lesson

No questions yet — be the first to ask.

Log in to ask a question about this lesson.

Summary

Flow's Formula resource type lets you compute a value using the same formula language used in formula fields and validation rules, referenced anywhere in the Flow via merge fields — variables, meanwhile, hold and pass values between elements as the Flow runs.