Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Defining workflow variables

You can define your own variables in a workflow. Use them to save an Action's result, calculate a value once and reuse it, or keep a value that different branches can update.

Define a variable

  1. Open the workflow for editing.

  2. Click Variables, then Declare a variable. If variables already exist, use a row's Insert controls to add another.

  3. Enter a key, such as points, and choose its type. Use Number for a points total, String for an email address, or Object for several related fields. Enable Array if the variable holds a list.

  4. Click Save.

Keys must start with a letter and contain only letters, numbers, and underscores. Each key must be unique in the workflow and cannot duplicate a Begin input field. If a workflow variable has the same key as a module variable, the workflow variable takes its place inside that workflow.

The variable is now available throughout the workflow, but its value starts as null. Defining a variable does not give it an initial value.

Assign a value

Add a Set variable step and click Add assignment. Choose the variable, then use the parameter editor to build its value. You can also choose Create... in the variable dropdown to declare a new variable while adding an assignment.

Assignments are also available in the Begin, Action, and File Export steps. Begin assignments can use the full ROOT_INPUT; Action output assignments can use ACTION_OUTPUT; File Export output assignments can use FILE_OUTPUT. Save any output you need later into a workflow variable.

Each assignment must produce the variable's declared type. Assignments run in order, so a later assignment in the same step can use a value assigned just above it. A new assignment replaces the variable's previous value.

Use the variable

In any later parameter, choose Variable Selector, then select the variable by its key. For an Object or a reference to a synced record, you can select individual fields.

The value belongs to this workflow execution. It is not shared with other executions, and updating it does not update a synced record or a module setting. If a branch skips the assignment, the variable keeps its previous value, or null if nothing has assigned it yet.

Example: points per check-in

This complete copied workflow accepts a check_ins number, assigns check_ins * 10 to a declared points variable, and returns an object containing points. With input {"check_ins": 3}, the output is {"points": 30}.

The top-level variables array declares the variables and their types. A step's variable_assignments list identifies the target by key and supplies its value using node_parameter. A global_var_selector reads the value by the same key.

For variable keys available in triggers, current-step outputs, and array operations, see Variables.

Last updated

Was this helpful?