Set Variable 📥
Sets or updates workflow variables with static values or variable expressions.
Node type: setVariable
Category: Logic
Actor: setVariable (2 threads)
Description​
The Set Variable node creates or updates workflow variables. It is the simplest way to assign values — no scripting needed. Use it to:
- Initialize variables with default values
- Copy variable values from one name to another
- Combine variables into a new string
- Set constants for use downstream
Properties​
| Property | Type | Required | Description |
|---|---|---|---|
mappings | variableMappings | Yes | Key-value pairs: variable name → value expression |
Mapping Syntax​
Each mapping entry has:
- Key — the variable name to set (output variable)
- Value — a static value or a
{varName}expression
| Value Type | Example | Result |
|---|---|---|
| Static string | hello world | Sets variable to hello world |
| Variable reference | {customerName} | Copies the current value of customerName |
| Template | Hello {customerName}, your order {orderId} is ready | Concatenated string |
| Number | 0 | Sets to numeric zero (string) |
| JSON string | {"key": "value"} | Sets to JSON string |
Examples​
Initialize Default Values​
defaultStatus → pending
retryCount → 0
notificationSent → false
Copy and Rename​
recipientEmail → {customerEmail}
displayName → {firstName} {lastName}
fullAddress → {street}, {city}, {state} {zip}
Build Dynamic Strings​
emailSubject → Your order #{orderId} from {companyName} is confirmed
smsMessage → Hi {firstName}! Order {orderId} ships tomorrow. Track: {trackingUrl}
Set API Request Parameters​
searchQuery → customer_id:{customerId} AND status:active
authHeader → Bearer {env.API_TOKEN}
Node in Designer​
In the workflow designer, the Set Variable node shows each mapping as a row with a key field and a value field. The UI shows a + button to add new rows and an × button to remove existing ones.
Connections​
| Connection Type | Description |
|---|---|
sequenceFlow (incoming) | Arrives here from the previous node |
sequenceFlow (outgoing) | Continues to the next node after all variables are set |
The Set Variable node does not have success/error flow split — it always continues on sequenceFlow unless the whole node handler fails (which would be an internal engine error).
Best Practices​
- Use Set Variable at the start of a workflow to establish default values for all variables you'll need
- Rename ambiguous variable names from external APIs to meaningful names for the rest of the workflow (e.g.,
data.id→customerId) - Use Set Variable instead of Script Task for simple assignments — it's faster and clearer in the designer
- For complex transformations, use Script Task instead