Portal Community

Example 1 — Assign a Literal String Status

Store a hard-coded status value at the start of a workflow so all downstream nodes share a consistent initial state reference. This is useful when the workflow begins with a known default that may be updated later.

{
  "node_type": "VariableAssignment",
  "name": "InitialiseStatus",
  "config": {
    "variable_name": "orderStatus",
    "value": "pending",
    "scope": "execution"
  }
}
Outcome: var.orderStatus is set to "pending" for the entire workflow run. A Switch node later can branch on this value.

Example 2 — Compute Invoice Total from Input Fields

After a webhook trigger delivers an order payload, calculate the invoice total by summing subtotal and tax from the trigger input. Store the result so downstream email and PDF nodes can reference it without repeating the calculation.

{
  "node_type": "VariableAssignment",
  "name": "ComputeInvoiceTotal",
  "config": {
    "variable_name": "invoiceTotal",
    "value_expression": "{@ $input.current.subtotal + $input.current.taxAmount }",
    "scope": "execution"
  }
}
Outcome: If subtotal is 450.00 and taxAmount is 36.00, then var.invoiceTotal = 486.00. Both the email node and PDF generator can use {@ var.invoiceTotal }.

Example 3 — Cache an Upstream Node's API Response

A GetCustomer HTTP node fetches customer data from the CRM. Store the entire response body in a variable so multiple downstream nodes (email, approval form, logging) can reference it without triggering additional HTTP calls.

{
  "node_type": "VariableAssignment",
  "name": "CacheCustomerData",
  "config": {
    "variable_name": "customerRecord",
    "value_expression": "{@ output.GetCustomer.data }",
    "scope": "execution"
  }
}
Outcome: var.customerRecord holds the full customer object. Downstream nodes use {@ var.customerRecord.name }, {@ var.customerRecord.email }, etc., without re-fetching the API.

Example 4 — Loop Accumulator (Running Total)

Inside a Loop node iterating over invoice line items, accumulate the running total. Use local scope for the increment variable so only the execution-scoped total persists after the loop exits.

// Before the loop — initialise the accumulator
{
  "node_type": "VariableAssignment",
  "name": "InitTotal",
  "config": {
    "variable_name": "runningTotal",
    "value": 0,
    "scope": "execution"
  }
}

// Inside the loop body — add current item amount
{
  "node_type": "VariableAssignment",
  "name": "AccumulateTotal",
  "config": {
    "variable_name": "runningTotal",
    "value_expression": "{@ var.runningTotal + $input.current.amount }",
    "scope": "execution"
  }
}
Outcome: After the loop finishes, var.runningTotal contains the sum of all line item amounts.

Example 5 — Remove a Sensitive Variable After Use

A workflow temporarily stores an API secret or session token. After the secure operation is complete, remove the variable to prevent accidental exposure in logs or downstream nodes.

{
  "node_type": "VariableAssignment",
  "name": "ClearSessionToken",
  "config": {
    "variable_name": "sessionToken",
    "value": null,
    "scope": "execution"
  }
}
Outcome: var.sessionToken is removed from workflow memory. Any subsequent reference to it returns null, preventing unintended use in later nodes.