Variables and Expressions
Variables and expressions help an automation use the right value at the right time.
Think of them as smart placeholders. Instead of typing one fixed value into a workflow, you tell Automation Hub where to get the value from when the job runs.
Why This Matters
Without variables, you may have to update the same value in many places.
For example, if the operations team email changes, you do not want to open 20 different jobs and edit each email step manually. You want to update the email once and let every job use the new value.
With variables, your automations become easier to reuse, easier to update, and less likely to break because of copied values.
The Basic Idea
{{gv.OpsTeamEmail}} to tell Automation Hub where to find the valueExample:
| Instead of typing this everywhere | Use this expression |
|---|---|
ops@example.com | {{gv.OpsTeamEmail}} |
Alice | {{$('FindCustomer').result.name}} |
12345 | {{trigger.payload.customerId}} |
Where Values Can Come From
There are three common places Automation Hub can get a value from.
1. Values From Earlier Steps
Use this when one step finds information and a later step needs that information.
Example: Send a Customer Email
{{$('FindCustomer').result.name}} from the previous step{{$('FindCustomer').result.email}}What the user writes in the message body:
Hello {{$('FindCustomer').result.name}}, your order is ready.
What the customer receives:
Hello Alice, your order is ready.
Use step references for customer names, ticket numbers, file names, totals, approval results, or anything created during the current run.
2. Values From the Trigger
Use this when the job is started by a webhook, schedule, or external event, and you need data from that event.
Example: Process an Incoming Webhook
{{trigger.payload.customerId}} to access the incoming dataThe same job handles every incoming request without changes, because it reads the relevant data from whatever triggered it.
Use trigger values for customer IDs, order numbers, event types, request bodies, or any data sent by the system that started the job.
3. Global Variables (Saved Settings)
Global variables are shared across all jobs in your environment. Updating a global variable immediately affects every job that references it, so review all dependent jobs before changing shared values like base URLs or team emails.
Use this when the same value is shared by many automations. Global variables are stored in Global Configurator and can be referenced by any job.
Example: Shared Team Email
OpsTeamEmail in Global Configurator{{gv.OpsTeamEmail}}Use global variables for team emails, standard folder paths, base URLs, environment names, API keys, and shared connection details. Encrypted variables (like passwords or API keys) are automatically decrypted at runtime.
Expression Syntax
All expressions are wrapped in double curly braces: {{ }}. Here are the expression types you can use.
Step References
Reference output from a previous step using the $() selector.
| Syntax | Description |
|---|---|
{{$('stepId').result.fieldName}} | Access a field from a step's output |
{{$('stepId').result.nested.field}} | Access a nested field |
{{$('stepId').result.rows[0].name}} | Access an item in an array |
Examples:
{{$('FindCustomer').result.email}}
{{$('QueryDB').result.rows[0].name}}
{{$('GetOrder').result.items[2].price}}
{{$('CallAPI').result.response.status}}
Global Variables
Reference shared settings stored in Global Configurator using the gv. prefix.
| Syntax | Description |
|---|---|
{{gv.VariableName}} | Access a global variable by name |
Examples:
{{gv.OpsTeamEmail}}
{{gv.SlackChannel}}
{{gv.BaseAPIUrl}}
{{gv.DatabasePassword}}
Trigger Context
Access data from the event that started the job using the trigger. prefix.
| Syntax | Description |
|---|---|
{{trigger.payload.fieldName}} | Access a field from the trigger payload |
{{trigger.payload.nested.field}} | Access nested trigger data |
Examples:
{{trigger.payload.customerId}}
{{trigger.payload.order.total}}
{{trigger.payload.eventType}}
JavaScript Expressions
Evaluate JavaScript inline for calculations, formatting, or logic.
| Syntax | Description |
|---|---|
{{2 + 3}} | Simple arithmetic |
{{Math.round(5.7)}} | Built-in JavaScript functions |
{{$('step').result.total * 1.1}} | Combine step data with calculations |
{{value > 100 ? 'VIP' : 'STANDARD'}} | Conditional (ternary) logic |
Examples:
{{$('QueryDB').result.total * 1.1}}
{{$('GetOrder').result.quantity > 100 ? 'BULK' : 'STANDARD'}}
{{Math.round($('CalcStep').result.average * 100) / 100}}
JavaScript expressions run in a sandboxed engine with no access to the file system or network.
Mixed/Inline Expressions
Embed one or more expressions within plain text. This is useful for building messages, subjects, or URLs dynamically.
Examples:
Hello {{$('FindCustomer').result.name}}, your order #{{$('GetOrder').result.orderId}} is ready.
Report for {{trigger.payload.month}} generated successfully. Sent to {{gv.OpsTeamEmail}}.
https://{{gv.BaseAPIUrl}}/customers/{{$('FindCustomer').result.customerId}}
Using Expressions in Practice
Here are common scenarios showing how to use expressions with the correct syntax.
Send a personalized email
| Field | Expression |
|---|---|
| To | {{$('FindCustomer').result.email}} |
| Subject | Order #{{$('GetOrder').result.orderId}} - Confirmation |
| Body | Hello {{$('FindCustomer').result.name}}, your order of {{$('GetOrder').result.quantity}} items has been confirmed. |
Post a Slack notification with calculated values
| Field | Expression |
|---|---|
| Channel | {{gv.SlackChannel}} |
| Message | Daily total: ${{$('SumSales').result.total}}. Tax estimate: ${{$('SumSales').result.total * 0.08}}. |
Build an API call from trigger data
| Field | Expression |
|---|---|
| URL | https://{{gv.BaseAPIUrl}}/customers/{{trigger.payload.customerId}} |
| Header | Bearer {{gv.APIToken}} |
Conditionally set a value
| Field | Expression |
|---|---|
| Priority | {{$('CheckOrder').result.amount > 1000 ? 'HIGH' : 'NORMAL'}} |
| Tier | {{$('GetCustomer').result.totalSpend > 10000 ? 'VIP' : 'STANDARD'}} |
How Automation Hub Fills the Values
When a job runs, Automation Hub resolves every expression automatically:
{{ }} patterns in all step configuration fieldsWhere Expressions Can Be Used
Expressions work in any step configuration field, including:
- Recipient, subject, and body fields (email, Slack, Teams)
- Query fields (database, API)
- URL and header fields (API calls)
- Condition fields (for conditional steps)
- Loop configuration fields
- File paths and folder names
Which One Should You Use?
| If the value is... | Use this | Syntax example |
|---|---|---|
| Found by an earlier step | Step reference | {{$('FindCustomer').result.email}} |
| Sent by the system that triggered the job | Trigger context | {{trigger.payload.customerId}} |
| Shared by many jobs across your team | Global variable | {{gv.OpsTeamEmail}} |
| Different between dev, test, and production | Global variable | {{gv.EnvironmentName}} |
| A calculation based on other values | JavaScript expression | {{$('Step1').result.price * 1.1}} |
| A conditional choice | Ternary expression | {{$('Step1').result.qty > 100 ? 'BULK' : 'STANDARD'}} |
Tips for Better Automations
Use clear step names
- Name steps like
FindCustomer,CreateReport, orSendEmail - Clear names make expressions easier to read:
{{$('FindCustomer').result.name}}is self-explanatory
Start with simple expressions
- Begin with one or two dynamic values in a job
- Add more only when the flow is easy to follow
Think about where the value lives
- If a value comes from earlier in the run, use a step reference
- If a value comes from the event that started the job, use a trigger context
- If a value belongs to the whole team, use a global variable
Use global variables for secrets
- Store API keys, passwords, and tokens as encrypted global variables
- They are automatically decrypted at runtime and kept secure
Test with friendly sample data
Use Test Mode to preview how expressions resolve before running the automation in production. This lets you catch typos, missing fields, and incorrect paths before they affect real data.
- Use examples like
Alice,April, orFinance - Confirm the final message, report, or notification looks right
Ask one question when unsure
- "Where should this value come from?"
If the answer is "a previous step," use {{$('StepName').result.field}}. If the answer is "the trigger event," use {{trigger.payload.field}}. If the answer is "a shared team setting," use {{gv.VariableName}}.