Skip to content

Variable Task

Overview

The Variable Task stores and retrieves data within a workflow execution. Use it for temporary calculations, counters, flags, intermediate results, or passing data between distant tasks.

When to use this task:

  • Store calculated values for later use
  • Count loop iterations or successes
  • Set flags for conditional logic
  • Cache data to avoid repeat queries
  • Accumulate totals across loop
  • Store intermediate processing results
  • Pass data across complex workflows

Key Features:

  • Store any data type (text, numbers, JSON)
  • Persist within workflow execution
  • Access anywhere in workflow
  • Update incrementally
  • Multiple variables per workflow
  • No external dependencies
  • Fast and reliable

Outputs

Reference fields as {{task_<ID>_<field>}}.

Field Type Notes
task_id string This task's own ID.
value string The stored value.
updated_task_id string The ID of the Variable task that was written to, when this task updated or appended to another one.
appended string Append only: the text this task added. Not the whole value — read that from the variable itself.
length number Append only: how long the variable is now, in characters. Also reported when an append is refused.

Always emitted

Field Type Notes
run boolean Whether the task succeeded.
run_text string What happened, including the reason on failure.

Fields marked as action-dependent may be absent

This task does several different things depending on its action setting, and only the fields relevant to that action are emitted. Check a real run in the OUTPUT panel before referencing one downstream.

Quick Start

  1. Add Variable task
  2. Set variable name
  3. Set variable value
  4. Access later: {{task_41001_value}}
  5. Save

Simple Example:

Variable Name: lead_score
Value: {{task_42001_calculated_score}}

Use later: {{task_41001_value}}

Configuration

Builder fields

The Field column is the label as it appears in the task builder; Key is the name the value is stored under and referenced by.

Field Key Type Default Notes
Action action select create Options: Create Variable · Fetch Variable · Update Variable · Append to Variable
Task ID task_id text – Only shown when action is fetch, update, append
Variable Value value textarea – Only shown when action is create, update
Text to Append value textarea – Only shown when action is append
Delimiter delimiter text – Only shown when action is append. Left out while the variable is empty

Set Variable

Store calculation result:

Variable Name: total_revenue
Value: {{task_43001_sum_revenue}}

Store text:

Variable Name: status
Value: Processed

Store dynamic data:

Variable Name: contact_name
Value: {{task_47001_full_name}}

Store JSON:

Variable Name: contact_data
Value: {{task_43001_results_JSON}}

Variable Naming

Best practices:

  • Use descriptive names: lead_score not var1
  • Snake_case preferred: total_count not totalCount
  • Be specific: email_sent_count not count

Accessing Variables

After Variable task executes:

Access value:

{{task_41001_value}}

Use in If condition:

If {{task_41001_value}} > 100:
  → High value path

Use in Email:

Subject: Score: {{task_41001_value}}

Use in a later task:

UPDATE contacts SET score = ? WHERE id = ?
Parameters: {{task_41001_value}}, {{task_47001_contact_id}}

Common Patterns

Counter

Increment in loop:

// Code task in loop
let count = parseInt(input.task_41001_value) || 0;
if (input.task_x_success) {
  count++;
}
return { counter: count };

Store new count:

Variable Name: success_count
Value: {{task_42001_counter}}

Access after loop:

Email: {{task_41001_value}} items processed successfully

Flag Storage

Set flag based on condition:

// Code task
const isHighValue = parseFloat(input.task_43001_total) > 10000;
return { high_value_flag: isHighValue };

Store flag:

Variable Name: is_high_value
Value: {{task_42001_high_value_flag}}

Use in If task:

If {{task_41001_value}} = true:
  → Send to sales manager

Cache Data

Avoid repeat queries:

1. Match to Client - look the client up once
2. Variable - store the value you need repeatedly
3. Loop - process the items
4. In loop: read {{task_41001_value}} instead of looking it up again

Building a list inside a loop

Use Append to Variable, not Update. Append adds your text to the end of the variable in one step, so a loop set to run its items in parallel can build the list without items overwriting each other:

Action:        Append to Variable
Task ID:       41001          ← the Create Variable task
Text to Append: {{task_29001_loop_value}}
Delimiter:      |

Update does the opposite — it reads the whole value, changes it, and writes it back. Two items doing that at once lose one another's text, so a loop whose items update a variable created outside the loop is made to run one item at a time. Its node says "Sequential", and the loop's panel names the task responsible. Switching that task to Append gives the loop its parallelism back.

Things worth knowing:

  • The delimiter is skipped while the variable is empty, so the list never opens with one.
  • Entries appear in the order items finish, not in list order. In parallel that is not the order you started them in.
  • A variable holds 100,000 characters. An append past that fails with "Variable is full: 100,000 character limit reached" and leaves the value unchanged — it is never cut short, so a summary that looks complete always is.
  • The output is the appended text and the resulting length, not the whole value. Read the value from the Create Variable task.

Accumulator

Sum values across loop:

// Code task in loop
let total = parseFloat(input.task_41001_value) || 0;
total += parseFloat(input.task_29001_amount) || 0;
return { running_total: total };

Update variable:

Variable Name: total_amount
Value: {{task_42001_running_total}}

Real-World Examples

Carry a value past a long branch

Webhook In
  └─ Variable        store the order reference
      └─ If Statement
          └─ Email   quote {{task_41001_value}} in the message

The Variable task holds a value so a task further down the workflow can read it without referencing a task several steps back.

Keep a running count inside a loop

Loop
  └─ Math Formula   add 1 to the current total
      └─ Variable   store the new total

Read it back later as {{task_41001_value}}. updated_task_id tells you which Variable task was written to when one Variable task updates another.

A variable lives for one workflow run

It is not storage between runs. For something that must survive the run, write it to the client record with Edit Client or to a sheet with Google Sheets.

Best Practices

Naming Conventions

  1. Descriptive names - email_sent_count not count
  2. Context-specific - loop_success_total not total
  3. Consistent format - All snake_case or all camelCase
  4. Avoid conflicts - Don't reuse same name for different data

When to Use Variables

Good use cases:

  • Calculations used multiple times
  • Counters and accumulators
  • Flags for conditional logic
  • Caching expensive queries

Bad use cases:

  • Data available from previous task (just use that task's output)
  • Passing data to next immediate task (direct reference better)
  • Storing large datasets (use database instead)

Performance

  1. Don't overuse - Only store what you need later
  2. Keep values small - Large JSON can slow workflow
  3. Clean data - Store processed, not raw data
  4. Use direct references - If task output available, use it directly

Data Types

Store appropriate format:

Numbers:

Value: 42

Text:

Value: Completed

Boolean:

Value: true

JSON:

Value: {"key": "value"}

Troubleshooting

Variable Empty or Undefined

Check:

  1. Variable task executed before access?
  2. Correct task ID in reference?
  3. Value set in configuration?
  4. Previous task output exists?

Debug:

View execution history → Variable task → Check output

Can't Access in Loop

Issue: Variable set outside loop, not updating inside

Solution: Update variable inside loop:

1. Initialize variable (before loop)
2. In loop: Read variable, calculate, update variable

Lost After Loop

Issue: Variable value from loop lost

Cause: Variable holds last iteration value only

Solution: Use accumulator pattern (see Example 2).

Number Stored as Text

Issue: Math operations fail

Solution: Parse in Code task:

const value = parseFloat(input.task_41001_value) || 0;

Frequently Asked Questions

How long does variable data persist?

Duration of single workflow execution. Not saved between runs.

Can I use variables across different workflows?

No. Use database or Edit Client task for persistent storage.

How many variables can I create?

Unlimited, but practical limit ~10-20 per workflow for clarity.

Can I store arrays?

Yes, as JSON:

Value: [1, 2, 3, 4, 5]
Access: {{task_41001_value}}
Parse in Code task: JSON.parse(input.task_41001_value)

Can I update a variable?

Yes, add another Variable task with same name:

Variable Name: counter
Value: {{task_42001_new_count}}

Overwrites previous value.

What's difference between Variable and Edit Client?

  • Variable: Temporary, workflow-only, fast
  • Edit Client: Permanent, saved to CRM, slower

Can I use variables in If conditions?

Yes:

If {{task_41001_value}} > 100
If {{task_41001_value}} = "Completed"

How to access variable in different format?

Use Code task to transform:

const value = input.task_41001_value;
return {
  uppercase: value.toUpperCase(),
  length: value.length,
  reversed: value.split('').reverse().join(''),
};

  • Code Task - Calculate values to store
  • If Task - Conditional logic with variables
  • Loop Task - Counters and accumulators
  • Edit Client - Permanent storage alternative