tr Skip to content

Workflow Variables in FlowMattic: Define Once, Reuse Everywhere

FlowMattic Variables: one {{api_base}} variable feeds the API steps of several workflows, so changing it once updates them all.

Workflow variables in FlowMattic let you store a value once, give it a name, and use it in any field of any workflow as a {{name}} token. Change the value on the Variables screen and every workflow that references it picks up the new value on its next run.

They are for anyone who keeps typing the same base URL, list ID, sender address or prompt snippet into step after step. This guide covers the three kinds of variables FlowMattic offers, how they are replaced at run time, how a workflow can read and change them, and seven practical uses.

What are FlowMattic variables?

A variable is a named value that FlowMattic swaps into a step’s fields when the step runs. You manage them under FlowMattic → Variables, a screen with two lists and a search box that matches names and descriptions.

  • Custom Variables are the ones you create: a name, a value and an optional description.
  • System Variables are built in and always available: 24 of them for dates, times, formatting and test values.
  • Local variables are created by a workflow itself with the FlowMattic Tools app and belong to that one workflow.

Custom variables are stored in their own table in your WordPress database, so they are shared by every workflow on the site.

How workflow variables work

1. Create the variable

Click New Variable. The Create New Custom Variable window asks for three things:

  • Variable Name (required). It must be unique, without spaces or special characters, for example my_custom_var or myCustomVar.
  • Variable Value (required). Any text, number or boolean.
  • Variable Description (optional). What the variable is for, which helps when you share workflows or come back months later.

Click Create Variable. Each row in the list then offers Edit Variable, Duplicate and Delete Variable, plus a copy button that puts the ready-made {{name}} token on your clipboard.

FlowMattic Variables admin screen with Custom Variables and System Variables tables showing name, description and value columns.
The Variables screen lists your custom variables above the built-in system variables, each with a copy button for its token.

2. Use it in a step

Type the name in double curly braces into any step field, or open the dynamic tag picker in the workflow builder and choose it from the Variables group. A variable sits happily next to data from earlier steps, so an endpoint such as {{api_base}}/customers followed by an ID from the trigger resolves correctly.

3. FlowMattic fills it in at run time

When a step runs, FlowMattic looks for {{…}} tokens in its settings and replaces each known variable with its current value. Workflows read the value at run time rather than a copy saved in the step, which is why one edit on the Variables screen reaches every workflow at once.

The 24 system variables

VariablesWhat they insert
iso_8601_utc, iso_8601_localThe current date and time in ISO 8601, in UTC or the site time zone.
utc_cur_date_time_24, utc_cur_date_time_12, utc_cur_date, utc_cur_time_24, utc_cur_time_12, utc_cur_timestampThe current date, time or timestamp in UTC, in 24-hour or 12-hour form.
local_cur_date_time24, local_cur_date_time12, local_cur_date, local_cur_time_24, local_cur_time_12, local_cur_timestampThe same values in the site’s local time.
cur_year, cur_month, cur_dayThe current year, month and day in local time.
blank, space, line_breakAn empty value, a single space or a line break, for stitching text together.
boolean:true, boolean:falseA boolean. After the colon, true, yes or 1 give true; anything else gives false.
random_number:100A random number from 1 up to the number after the colon.
random_string:10A random string of the length after the colon, between 2 and 100 characters.

Read and change variables from a workflow

The FlowMattic Tools app has six actions for variables. Use them when a workflow needs to remember something for later.

ActionFieldsWhat it does
Get Variable ValueVariable NameReturns the current value of a custom variable.
Set Variable ValueVariable Name, Variable ValueOverwrites the value of an existing custom variable.
Create Local VariableVariable Name, Variable Type (String or Array), Variable Value or Variable ValuesStores a value for this workflow and returns its Variable ID.
Get Local VariableVariable IDReturns the stored value.
Update Local VariableVariable ID, Variable Type, valueReplaces the stored value.
Delete Local VariableVariable IDRemoves it.

In the Tools actions, type the variable name without curly braces. Local variables are addressed by their Variable ID, which the Create step returns; the ID is built from the workflow and the name, so it stays the same each time that workflow creates the variable.

FlowMattic workflow builder with a Schedule trigger and a FlowMattic Tools Set Variable Value step showing Variable Name and Variable Value fields.
A Set Variable Value step from FlowMattic Tools stores the last synced ID for the next scheduled run.

Use cases

Switch an integration from sandbox to live in one edit

A SaaS team’s Custom App actions and API steps all start with {{api_base}}. During testing it points at the sandbox; on launch day one edit on the Variables screen moves every workflow to production.

Flow: Webhook → API request to {{api_base}}/orders → WP Tables row

One support address in every notification

Order confirmations, booking reminders and failure alerts all show {{support_email}} as the reply address. When the support inbox moves to [email protected], every message follows.

Flow: WooCommerce new order → Send email (Reply-To {{support_email}})

Invoice numbers that roll over each year

An e-commerce shop builds invoice numbers from {{invoice_prefix}}-{{cur_year}}- plus the order ID. The prefix is set once; the year changes on its own on 1 January.

Flow: Order paid → PDF invoice with {{invoice_prefix}}-{{cur_year}} → Email the customer

A sync that remembers where it stopped

An internal ops workflow runs every hour, reads {{last_synced_id}}, fetches only newer records from an API, and ends with Set Variable Value so the next run starts from the new high-water mark.

Flow: Schedule (every hour) → API request since {{last_synced_id}} → Iterator → Set Variable Value

One workflow, many client sites

An agency imports the same lead workflow on each client’s site. The steps reference {{crm_list_id}} and {{sales_channel}}, and each site defines its own values, so the workflow itself never needs editing per client.

Flow: Form submission → CRM add contact to {{crm_list_id}} → Chat message to {{sales_channel}}

A shared brand voice for AI steps

A marketing team keeps its tone of voice in {{brand_voice}} and adds it to the prompt of every AI Agent that writes captions, replies or summaries. Updating the guidance updates all of them.

Flow: New post published → AI Agent (prompt includes {{brand_voice}}) → Social post

Unique welcome coupons

Each new customer gets a coupon code like WELCOME-{{random_string:8}}, generated fresh every run with no extra step.

Flow: New user registered → Create WooCommerce coupon → Welcome email with the code

Tips and gotchas

  • Create before you set. Set Variable Value updates a variable that already exists; it does not create one. Add the variable on the Variables screen first.
  • Deleted means raw text. Workflows that still reference a deleted variable get its name instead of a value.
  • Saving an existing name updates it. Creating a variable with a name that is already taken changes that variable’s value.
  • Special characters are escaped. Values are inserted with characters such as &, < and quotes turned into HTML entities, so keep values that feed URLs or JSON plain.
  • Local variables outlast the run. A local variable is kept for its workflow until a Delete Local Variable step removes it, so delete it at the end if it should not carry over.
  • PHP values are off by default. A value that starts with PHP:, such as PHP:time(), is only evaluated when the site owner adds define( 'FLOWMATTIC_ALLOW_PHP_VARS', true ); to wp-config.php. Without it, the value is treated as plain text.
  • See the value a run used. In Task History, each step’s Request Payload shows the inputs it ran with, variables and dynamic tags already filled in, so you can check what a variable resolved to on a live run.
  • Keep secrets in Connects. Variable values are shown in plain text on the Variables screen. API keys and tokens belong in Connects.

Related features

  • Connects: store API keys and OAuth sign-ins once, the dedicated place for credentials.
  • Custom Apps: private integrations whose endpoints pair well with a base URL variable. A body field’s Default Value can hold a variable such as {{cur_year}}, and with Use default when empty set to Yes it is sent whenever the mapped value is empty.
  • Variables overview: the feature page with more examples.

FAQ

How do I use workflow variables in FlowMattic?

Type its name in double curly braces, such as {{support_email}}, into any step field, or pick it from the Variables group in the dynamic tag picker. FlowMattic replaces it with the current value when the step runs.

What is the difference between custom, system and local variables?

Custom variables are values you define on the Variables screen and share across every workflow. System variables are 24 built-in values such as the current date and random strings. Local variables are created by a workflow with FlowMattic Tools and belong to that workflow only.

Can a workflow change a variable’s value?

Yes. The Set Variable Value action in FlowMattic Tools overwrites an existing custom variable, and Update Local Variable does the same for a local one. The next step or the next run reads the new value.

Can a variable run PHP code?

Only if the site owner turns it on. A value starting with PHP: is evaluated when FLOWMATTIC_ALLOW_PHP_VARS is set to true in wp-config.php; otherwise it stays plain text. For logic in a workflow, the PHP Functions step is usually the better fit.

Workflow variables are included with every FlowMattic plan, together with nearly 900 integrations to use them in. Try FlowMattic and replace your first copy-pasted value with a variable.

More from the blog