Intermediate7 min

Using Variables

Variables let you pass data from one node to another. Every node outputs data that subsequent nodes can access.

Variable Basics

How Variables Work

  1. Each node produces output data
  2. Subsequent nodes can reference that data
  3. Use double curly braces: {{node.field}}

Variable Syntax

{{nodeName.path.to.field}}

Examples:

  • {{trigger.email}} - Email from form submission
  • {{http_request.response.body.id}} - ID from API response
  • {{loop.item.name}} - Current item in a loop

The Variable Picker

Click the button in any text field to open the variable picker.

Using the Picker

  1. Click a text input field
  2. Click the icon
  3. Browse available variables by node
  4. Click to insert

The picker shows:

  • All upstream nodes
  • Their output structure
  • Data types

Variable Sources

Trigger Data

The trigger node is always available as the first data source.

Form Submission:

{{trigger.fields.name}}
{{trigger.fields.email}}
{{trigger.submittedAt}}

Webhook:

{{trigger.body.userId}}
{{trigger.headers.authorization}}
{{trigger.query.page}}

Schedule:

{{trigger.scheduledTime}}
{{trigger.executionId}}

Previous Node Data

Access data from any node that runs before the current one.

{{http_request_1.response.body}}
{{send_email.messageId}}
{{database_query.rows}}

Loop Variables

Inside a loop, access the current item:

{{loop.item}}           // Current item
{{loop.index}}          // Current index (0-based)
{{loop.isFirst}}        // Boolean
{{loop.isLast}}         // Boolean

Expressions

Use JavaScript expressions for transformations.

Basic Expressions

{{trigger.amount * 1.1}}           // Math
{{trigger.name.toUpperCase()}}     // String methods
{{trigger.items.length}}           // Array length

Conditional Expressions

{{trigger.status === 'active' ? 'Yes' : 'No'}}
{{trigger.count > 0 ? trigger.count : 'None'}}

Date Formatting

{{new Date(trigger.createdAt).toLocaleDateString()}}
{{new Date().toISOString()}}

Common Patterns

Building URLs

https://api.example.com/users/{{http_request.response.body.id}}

Composing Messages

Hello {{trigger.fields.name}},

Thanks for your {{trigger.fields.type}} submission.
Your reference number is {{database_insert.id}}.

Array Operations

{{trigger.items.map(i => i.name).join(', ')}}
{{trigger.items.filter(i => i.active).length}}

Debugging Variables

View Node Output

  1. Run your workflow in test mode
  2. Click any completed node
  3. View the Output tab
  4. See the exact data structure

Common Issues

Variable not found:

  • Check spelling and case sensitivity
  • Ensure the node runs before the current one
  • Verify the path matches the data structure

Undefined value:

  • The field may not exist in all cases
  • Use optional chaining: {{trigger.user?.name}}
  • Provide defaults: {{trigger.name || 'Guest'}}

Best Practices

  1. Use descriptive node names - Makes variables easier to understand
  2. Test with real data - Ensure variables resolve correctly
  3. Handle missing data - Use defaults for optional fields
  4. Keep expressions simple - Complex logic belongs in Code nodes

Next Steps

Tags

workflowsvariablesdata