Skip to main content

Variable management

During the workflow execution, the input data and the intermediate data are located in variables.

Copy the path of a value

From the test panel or when consulting the context (in the editor), click a value to copy its path (e.g. data.orderId) and reuse it in a variable via {{data.orderId}} — see Use the editor.

Variable types​

Ecosystem offers different types of variables:

  • Input variables: to access the data sent by the trigger
  • Context variables: to access the data between the nodes of a workflow
  • Dictionary variables: to access data that differs according to the environment

Input variables​

Some triggers allow passing input data, and accessing it during the workflow execution:

  • File trigger: access the data of the file that triggered the execution
  • HTTP request trigger: by sending the request, pass information by writing it in the body

Access an input variable​

It is possible to access the data transmitted by the trigger from any node of a workflow. The values are contained in the data object.

Example:

A workflow is triggered by an API call, with the following information in the body:

curl --location --request POST 'https://api.example.com/flux-test' \
--header 'Content-Type: application/json' \
--data '{
"start_date":"2025-09-01",
"end_date":"2025-09-30"
}'

To retrieve the value of start_date in a code node of your workflow, use the following syntax:

data.start_date

Outside the nodes accepting code, the use of double curly braces {{ }} is necessary:

{{data.start_date}}
💡 Automatic parsing

If your input data is not in JSON, it will be automatically parsed! You can therefore process your data directly as JSON in your nodes without having to do a manual conversion.

Context variables​

Saving variables in the context allows accessing their value in other nodes.

Context variables are similar to the declaration of variables in traditional code:

  • Classic code: const myVar = 'toto'
  • In Ecosystem: context.myVar = 'toto'

Declare a variable​

To declare a context variable, in a code node, use the context.myVar = 'toto' syntax to declare a variable.

// example of variable declaration
context.myVar = 'toto'
⚡ Performance

Use the classic const myVar = 'toto' syntax if you don't need to access the variable in other nodes. This improves performance by avoiding storing useless variables in the global context.

Access a context variable​

In a node accepting code​

It is possible to read a context variable in the code node where it was declared, and in all the following nodes.

// example in a condition node
return context.myVar === 'titi'

Outside the nodes accepting code​

Outside the nodes accepting code, the use of double curly braces {{ }} is necessary.

Example of use in an HTTP call node:

https://api.example.com/users/{{context.userId}}

Modify the value of a variable​

Modifying the value of a variable is identical to the declaration.

// declaration of the variable
context.myVar = 'toto'

// modification of the variable, further in the code or in another node
context.myVar = 'titi'

// myVar will then be worth 'titi'

Advanced Handlebars syntax​

Escape JSON with triple curly braces {{{ }}}​

The double curly braces {{ }} escape the result (HTML, JSON). To insert a raw, non-escaped value, use the triple curly braces:

{{{ context.customer }}}

Example: send a complete JSON object in the body of an HTTP Request node or of a call, without it being encoded as a string.

Execute an expression with {$ … $}​

The {$ … $} syntax executes a JavaScript expression and inserts its result:

{$ libs.uuid() $}

Example: generate a unique identifier in a node that does not accept code:

https://api.example.com/users/{$ libs.uuid() $}

Access a key containing special characters with the brackets [ ]​

If a key contains spaces, an @, a dash or any other non-standard character, surround it with brackets:

  • Key with space: {{ context.[last name] }}
  • Key starting with @: {{ context.[@id] }}
  • Index of an array: {{ context.items.[0] }}

Without the brackets, the key would be interpreted as a succession of non-existent properties and the value would be empty.

Dictionary variables​

Dictionary variables allow accessing values dynamized according to the execution environment (dev, staging, production). They are particularly useful for calls to external APIs or the use of servers (SFTP, etc.).

Format: a dictionary value is expressed in the {{dictionaries.nomDuDico.cleDuDico}} format, which allows adapting the value to the environment without modifying the workflow.

Declare a variable​

To create and fill in dictionary variables, see the Dictionaries module.

Access a variable​

You can access the value of a dictionary variable from any node of a workflow.

In a node accepting code​

// example in a condition node
return dictionaries.my_service.my_variable === 'titi'

Outside the nodes accepting code​

Outside the nodes accepting code, the use of double curly braces is necessary:

{{dictionaries.my_service.my_variable}}

Usage examples​

API URL:

{
"url": "{{dictionaries.api.baseUrl}}/orders"
}

Authentication header:

{
"headers": {
"Authorization": "Bearer {{dictionaries.auth.apiToken}}"
}
}

System variables (metadata)​

A metadata system object is available in read-only in all workflows. It contains information about the current execution:

{
"metadata": {
"traceId": "b2d9a31b-bd76-4e1f-a2eb-062bf8eb56b4",
"triggerExecutionId": "b2d9a31b-bd76-4e1f-a2eb-062bf8eb56b4",
"environment": {
"id": "1ddf05dc-30a2-495d-b7a1-c9b8b9f78532",
"slug": "studio",
"name": "Studio",
"isBuild": false,
"isProd": false
}
}
}
FieldDescription
traceIdUnique execution identifier — useful in the error alerts
triggerExecutionIdExecution identifier of the trigger
environmentExecution environment: id, slug, name, isBuild (execution linked to a build) and isProd (production environment)

Access: {{metadata.traceId}} outside the nodes accepting code, or metadata.traceId in a Code node.

Data mapping best practices​

Transforming data between systems (mapping), variable naming and the extractor vs Code node choice are covered in Best practices — Data mapping.

Code assistant on Chat Ecosystem

The Code assistant on Chat Ecosystem helps generate code for your workflows with the full context of your organization — see Chat Ecosystem Assistant.

Next steps​