Custom variables and variable operations
Create your own variables with Set variable and use the set, append and increment operations for counters and dynamic text.
Watch this step in the video · Variables
What custom variables are for
On top of the variables a trigger carries, you can create your own with the Set variable node and change them as the flow runs. They are perfect for counters (retries, number of reminders), for building text out of several pieces of data, or for storing the answer to a question or an API response to use later.
This article assumes you already know the basics of variables. If you're just starting, read Trigger and node variables first.
Creating a variable with Set variable
- In the workflow editor drag the Set variable node onto the canvas and connect it where it belongs.
- Open it and click Add to create an assignment row.
- In Name type the identifier (without the
$), for exampleattempts. - In Value type the content. It can be fixed text or include other variables:
Order from {{$contact.first_name}}. - Pick the operation (right-hand column) and save the workflow.
From there the variable is available as {{$attempts}} to every node that comes after it, and it even survives waits (Delay / Wait nodes).
The three variable operations
The operation column on each Set variable row defines how the value is applied:
- set (default): overwrite the value.
attempts=0. - += str (append): concatenate the value as text onto the end of the current one. Handy for building a list or a long message in parts.
- += num (increment): treat the variable as a number and add the value. If you leave the value empty, it adds
+1. Ideal for retry or reminder counters.
A classic counter pattern: a Set variable node at the start with attempts = 0 (operation set), and inside a retry loop another Set variable with attempts set to += num and an empty value, which adds 1 each pass. Then an If/Else node compares {{$attempts}} against a limit.
Combining variables in a value
Any value field accepts interpolation, so you can mix text and several variables in a single assignment:
full_name = {{$contact.first_name}} {{$contact.last_name}}
summary = Customer {{$contact.display_name}} ({{$contact.phone}}) - channel {{$conversation.channel_name}}
Remember that a null value (for example a contact with no last name) is replaced by an empty string, not by the literal token.
Verifying the result
- Click Test in the toolbar and launch a run.
- Open the Timeline panel at the bottom of the canvas and click the Set variable node.
- Check the output: you'll see the variable map with the final, already computed value.
If it doesn't work
- The counter doesn't add up: make sure the operation is += num, not set. With set the value is rewritten each pass instead of accumulating.
- Append joins the texts with no separation: the operator adds no spaces; include them yourself in the value (for example starting with a space).
- The variable isn't there later: the node that reads it must come after the Set variable in the flow. Parallel branches don't share what's defined in the other branch.
- += num leaves an odd decimal: if both operands are integers the result is an integer; if either is a decimal, the result will be a decimal.
Tip: name variables in lowercase with underscores (
total_reminders,order_id). That makes them easy to find in the Variables panel.
Tip: to reset a counter mid-flow, use another Set variable with operation set and value
0.
Related articles
Related articles
-
Build your first workflow
Omnifox workflows automate your operation: a trigger starts the automation and action nodes do the work. Build a welcome message in minutes.
-
Workflow triggers catalog
Learn which events can start a workflow automatically in Omnifox.
-
Workflows complete guide
Workflows in depth, in 54 chapters: triggers, nodes, variables, testing, history, templates, import and export, with every setting explained and a real workflow end to end.
-
Action nodes available in workflows
Discover the actions a workflow can run automatically.
-
Conditions and branching (if/then) in a workflow
Make your flows take decisions and follow different paths based on each contact data.