Skip to main content

Variables

Variable steps manage data storage during flow execution. Variables hold intermediate results, enable data transformation, and store values for use across multiple steps.

New Variable

Declares a new variable to store data during flow execution.

ParameterDescription
NameUnique name for the variable
TypeThe variable's data type (String, Integer, Entity, DateTime, Money, etc.)
Is ListWhen enabled, the variable holds a list (array) of the chosen type instead of a single value

Enable Is List on the type to declare an array/collection variable of that type. New Variable only declares the variable; assign it a value with Update Variable, Add Item to Collection, or the loop/iterator steps.

Example - Simple Variable:

NEW VARIABLE
Name: TotalAmount
Type: Money

UPDATE VARIABLE
Variable: TotalAmount
Set Variable: 0

Example - Entity Variable:

NEW VARIABLE
Name: ProcessedOrder
Type: Entity (Order)

Example - Collection Variable:

NEW VARIABLE
Name: SelectedProducts
Type: Entity (Product)
Is List: true

Update Variable

Changes the value of an existing variable.

ParameterDescription
VariableThe variable to update
Set VariableThe new value to assign

Example - Simple Update:

UPDATE VARIABLE
Variable: TotalAmount
Set Variable: TotalAmount + LineItem.Amount

Example - Update Entity Field:

UPDATE VARIABLE
Variable: ProcessedOrder.Status
Set Variable: "Completed"

To grow or shrink a list variable, use the dedicated Add Item to Collection / Remove Item from Collection steps rather than reassigning it here. See Data Operations.

Set Output

Sets the output values that will be returned when the flow completes.

ParameterDescription
Output BindingsMap of output names to values

Outputs are defined in the flow's structure and Set Output assigns values to them. A flow can have multiple Set Output steps - the last value set for each output is what gets returned.

Example:

SET OUTPUT
Output Bindings:
Success: true
ProcessedCount: TotalProcessed
ResultMessage: "Processed " + TotalProcessed + " records"

Conditional Outputs:

CONDITION: Was Successful?
Condition: ErrorCount == 0

TRUE BRANCH:
SET OUTPUT
Success: true
Message: "All records processed"

FALSE BRANCH:
SET OUTPUT
Success: false
Message: "Completed with " + ErrorCount + " errors"

Variable Scope

Variables are scoped to where they are created:

ScopeVisibility
Flow LevelAvailable to all steps in the flow
Branch LevelAvailable only within the branch (Condition/Switch)
Loop LevelAvailable only within the loop/iterator

Example:

NEW VARIABLE: FlowTotal (Flow Level)

ITERATOR: Process Items
Collection: Items

NEW VARIABLE: ItemTotal (Loop Level - recreated each iteration)

Steps:
→ ItemTotal = Item.Quantity * Item.Price
→ FlowTotal = FlowTotal + ItemTotal

Variable Types

TypeDescriptionExample Values
StringText data"Hello", "Order-001"
IntegerWhole numbers1, 42, -100
DecimalDecimal numbers3.14, 99.99
MoneyCurrency values$100.00, €50.00
BooleanTrue/falsetrue, false
DateTimeDate and time2024-01-15 10:30:00
Entity ReferenceReference to a recordAccount ID, Contact ID
EntityComplete entity recordFull Account record
Option SetEnumerated valueStatus, Priority

Best Practices

Initialize Variables: Always set an initial value, especially for variables used in calculations. Uninitialized variables can cause unexpected behavior.

Use Meaningful Names: Variable names should describe what they hold: CustomerTotalOrders is better than total or x.

Minimize Scope: Create variables at the most specific scope needed. Don't create flow-level variables if they're only used in one loop.

Clean Up Collections: When building collections in loops, be mindful of memory usage with large datasets.

Set Outputs Early for Errors: If your flow might fail or halt, set a default error output early so callers always receive meaningful results.

Avoid Overwriting Unintentionally: Be careful when updating variables in loops - make sure you're accumulating or replacing as intended.