Last updated
Last updated
Set Variable node is designed to create a new variable or update an existing one within your workflow. This node allows you to specify the variable's name, type, and value, providing a flexible way to manage data throughout your flow.
Specify the name of the variable you want to set or update.
Select the appropriate data type for the variable.
Enter the value you want to assign to the variable.
The node creates a new variable or updates an existing one with the specified name.
The value is converted to the specified data type before assignment.
For Object and Array types, the value should be a valid JSON string.
If the type conversion fails, the node will raise an error.
String: Text values
Integer: Non-decimal numbers
Float: Decimal numbers
Boolean: True
/False
values
Object: JSON objects
Array: JSON arrays
The node sets or updates the specified variable in the flow's context. You can access this variable using Magical Autocomplete (e.g., $.variables.<variable_name>
) in any node below this node.
Let's say you want to create a variable to store a user's age:
Set Variable Name to user_age
Set Variable Type to Integer
Set Value to 25
This will create an integer variable named user_age
with a value of 25
which can be accessed by $.variables.user_age
.
Be careful when setting Object or Array types - ensure the value is a valid JSON string. For example, {"hello": "world"}
For complex objects or arrays, consider using a JSON formatter to ensure valid syntax when entering the value.
Remember that variables set with this node are accessible throughout the rest of the workflow, so plan your variable names to avoid conflicts.
Field
Description
Required
Node name
true
Name of variable
The name of the variable to be set or updated.
true
Type
The data type of the variable (String, Integer, Float, Boolean, Object, or Array).
true
Value
The value to be assigned to the variable.
true