Set Variable
Description
Section titled “Description”The Set Variable module allows creating or updating a persistent variable in the workflow. Internally it uses the base Variable module with the add action, which creates the variable if it doesn’t exist or updates it if it already exists. It is the recommended node for storing data that needs to persist between workflow executions or be shared between different workflows of the same client. It supports multiple data types and dynamic variables in the key and value.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| key | text | Yes | Name of the variable to create/update. Supports {{variable}}. |
| data | text | Yes | Value to store. Can use dynamic variables like {{input.data}}. |
| type | select | No | Data type: Text (varchar), Integer, Float, Boolean, JSON, Array, Date, DateTime. Default: varchar. |
| persistent | boolean | No | If active, the variable persists between workflow executions. Default: true. |
Output
Section titled “Output”{ "nextModule": "siguiente_modulo", "data": { "variable": { "resolvedValue": "valor_guardado" } }}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "label": "Set Variable", "key": "ultimo_pedido_id", "data": "{{data.pedido_id}}", "type": "int", "persistent": true}- Internally executes the Variable module with
action: 'add'. - If the variable already exists, it is updated with the new value.
- Supports dynamic variables
{{variable}}in both the key and value. - Available data types are: varchar (text), int, float, boolean, json, array, date, datetime.
- Variables with
persistent: trueare maintained between workflow executions. - Variables are accessible from any workflow of the same client.
- parentNode:
variable.
Related Nodes
Section titled “Related Nodes”- getVariable (to get the variable value)
- deleteVariable (to delete the variable)
- variable (base module used internally)
- memory (obsolete alias)