Variables

Variable is a temporary data holder used to store, reuse, and manipulate values during workflow execution.

Variables help you:

  • Store API responses or transformed values

  • Pass data between steps

  • Control workflow logic dynamically

circle-info

Tip: Think of variables as memory boxes that live during workflow execution.

Earlier, many use cases relied on Code Runner snippets, but variables simplify this by reducing the need for custom code, improving workflow readability, making flows easier to debug and maintain, and enabling non-developers to configure and adjust logic with confidence.

Supported Data Types

Variables support the following data types:

Variable Declaration Guidelines

Declaration Areas

Naming Guidelines

  • Use camelCase

  • Use meaningful names

  • Avoid spaces or special characters

Examples:

  • ✅ orderId ❌ Order Id

  • ✅ customerEmailAddress ❌ Customeremailaddress (for better readability)

Initialize Variable

Initialize Variable is a step used to declare a variable and assign its initial value before it is used anywhere in the workflow.

When to Initialize?

  • At the start of a workflow

  • Before using a variable in conditions, API mapping, or transformations

Examples

Variable Name: customerEmail

Initial Value: ""

Type: String

Variable Name: retryCount

Initial Value: 0

Type: Number

Pre-Step & Post-Step Variables

Execution order

Pre-Step Variables → Actual Step Execution → Post-Step Variables

Pre-Step Variable

Pre-step variables are executede before the actual execution of a step.

Used for:

  • Preparing input data

  • Modifying request payloads

  • Setting headers or query parameters

  • Conditional execution

Examples

Before making Create Customer API call, to set a page limit of 1000 and to increment the page number by 1. It will increment the existing page number before making the api call.

Variable Name: page_limit

Value: 1000

Type: Number

Variable Name: page_number

Value: {{ page_number.increment() }}

Type: Number

Post-Step Variable

Post-step variables are executed after the respective step execution. Step responses can be referenced, but these variable definitions or updates are executed only after the step, so it cannot be accessed inside the step. Available to all downstream steps

Used for

  • Storing API responses

  • Extracting IDs

  • Passing data to next steps

  • Error or success validation

Examples

To store the customer ID which is returned in the response of that step, we can create post-step variable as following

Variable Name: createdCustomerId

Value: {{ <particular_step_id>.response.id }}

Type: Datahub

How to Use Variables

Variables can be used anywhere DataHub values are allowed. Just like referencing responses from another step, variables can be easily called and reused throughout the flow.

Using Variables in API Mapping

Using Variables in Conditions

Condition:

Updating Variable Value

Variables can be updated by assigning a static value or using inline transformation.

circle-check

Steps Supporting Pre-Step & Post-Step Variables

  • API Step

  • Decision Step

  • Loop Step

  • Formatter Step

  • Notification Step

  • Code Runner Step

  • Detail Logger Step

  • Set Response Step

  • Snippet Step

circle-info

Initialize Variable is a standalone step at the start of the workflow.

Variable Overview Panel

Since variables are defined inside steps, a Variable Overview Panel is provided for visibility and management. From this panel, you can:

  • View all variables used in the workflow

  • See each variable’s data type

  • Identify which steps create or update each variable

  • Jump directly to those steps

  • Search or filter variables

The panel also clearly distinguishes variables that share the same name across:

  • Workflow scope

  • Snippet scope

Deleting a Step

If a step that creates or updates variables is deleted:

  • All variable operations from that step are removed

  • A warning lists the affected variables

  • You can choose to move or reassign those variables

  • Any unresolved issues appear in the Global Error Panel

triangle-exclamation

Snippets and Variable Scope

  • Variables created inside a snippet are accessible only within that snippet

  • Variables created at the workflow level remain accessible across all workflow steps

Last updated

Was this helpful?