Variables
Variable blocks let you create computed or combined values for use in subsequent blocks. They're useful for building formatted strings, calculations, or transforming data. Open any automation in Automation from the top navigation and click Add Condition, Record or Action to add a variable block.
Creating a variable block
- Click Add Condition, Record or Action below any block.
- Select Variable.
- Add one or more variables in the configuration panel.
Variable configuration
Each variable has:
| Field | Required | Description |
|---|---|---|
| Name | Yes | How to reference this variable (for example, fullName, totalPrice) |
| Type | Yes | Data type: Text, Number, Boolean, DateTime, Object |
| Is Array | No | Turn on if the variable holds multiple values |
| Object Type | Required for Object type | User, Product, Order, or Custom |
| DateTime Variation | Required for DateTime type | Current time, add/subtract time, start/end periods |
| Default Value | No | The value or expression for this variable |
Variable types
| Type | Use for | Additional fields | Example |
|---|---|---|---|
| Text | Strings, messages, formatted content | None | Welcome, {{user.name}}! |
| Number | Calculations, counts | None | {{order.quantity}} * {{order.price}} |
| Boolean | True/false flags | None | {{user.isActive}} |
| DateTime | Date and time values | DateTime Variation + optional Value | Current date, future dates, date calculations |
| Object | Complex data structures | Object Type | User objects, custom data structures |
DateTime variables
DateTime variables support various time calculations:
| Variation | Description | Additional field |
|---|---|---|
| Current Date/Time | Current timestamp | None |
| Add/Subtract Days/Hours/Minutes | Time arithmetic | Value (number) |
| Start/End of Day/Month | Period boundaries | None |
Examples:
Variable: tomorrow (DateTime)
Type: DateTime, Variation: Add Days, Value: 1
Variable: monthStart (DateTime)
Type: DateTime, Variation: Start of Month
Variable: deadline (DateTime)
Type: DateTime, Variation: Add Hours, Value: 24
Object variables
Object variables can hold structured data:
| Object type | Use for |
|---|---|
| User | User profile data |
| Product | Product information |
| Order | Order/transaction data |
| Custom | Any custom object structure |
Example:
Variable: selectedUser (Object)
Type: Object, Object Type: User
Default Value: {{trigger.user}}
Using variables in expressions
The Default Value field supports variable interpolation. Click the + icon next to the input field to select available fields and variables.
Variable: welcomeMessage (Text)
Value: Hello {{user.firstName}} {{user.lastName}}, welcome to our platform!
Reference data from:
- Trigger:
{{triggerAlias.fieldName}} - Records:
{{recordAlias.fieldName}} - Other variables:
{{variableName}}
Multiple variables
Add multiple variables in a single block to organize related computations together:
- Click + Add Variable to create additional variables.
- Later variables can reference earlier ones in the same block.
- Variables are processed in order, so dependencies work correctly.
Example: Order processing variables
Variable Block:
- orderTotal (Number) = {{order.subtotal}} + {{order.tax}}
- discountApplied (Boolean) = {{orderTotal}} > 100
- finalAmount (Number) = {{discountApplied}} ? {{orderTotal}} * 0.9 : {{orderTotal}}
- confirmationMessage (Text) = Order total: ${{finalAmount}}
Using variables in actions
Reference your variables in action configurations:
Variable Block:
- customerName (Text) = {{order.customer.name}}
- orderTotal (Number) = {{order.total}}
- isPriority (Boolean) = {{order.priority}} === 'high'
- deliveryDate (DateTime) = Add Days: 2
- customerData (Object, User) = {{order.customer}}
Email Action:
Subject: Order confirmation for {{customerName}}
Body: Your order total is ${{orderTotal}}.
Priority delivery: {{isPriority}}.
Expected delivery: {{deliveryDate}}
Example: Building a notification message
Trigger: Order completed (alias: order)
├─ Record: Find customer (alias: customer)
├─ Variable Block:
│ - recipientName (Text) = {{customer.firstName}}
│ - orderTotal (Number) = {{order.subtotal}} + {{order.tax}}
│ - deliveryDate (DateTime) = Add Days: 3
│ - customerObj (Object, User) = {{customer}}
│ - orderSummary (Text) = Order #{{order.id}} - ${{orderTotal}}
└─ Action: Send Email
To: {{customer.email}}
Subject: {{orderSummary}}
Body: Hi {{recipientName}}, your order will arrive by {{deliveryDate}}!
Best practices
- Use descriptive names —
formattedAddressis clearer thanvar1 - Group related variables — Put calculations, formatting, and logic together in one block
- Leverage variable types — Use DateTime for date calculations, Object for structured data
- Order dependencies correctly — Define base variables first, then derived ones
- Simplify complex actions — Create variables first, then use them in actions
Related
- Conditions — Use variables in conditional logic
- Actions Overview — Reference variables in action configurations
- Records — Combine with query data