Assign
Assigns a string value to a variable with configurable scope (Global, Flow, Local, Message, or Custom).
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Value - String value to assign to the variable.
Options
This node does not have configurable options, but the output variable scope can be configured.
Output
- String - The assigned string value stored in the specified variable with the configured scope.
How It Works
The Assign node allows you to store a string value in a variable with different scope levels:
- Global - Variable is accessible across all flows in the project
- Flow - Variable is accessible within the current flow only
- Local - Variable is accessible within the current execution context
- Message - Variable is attached to the message object (default)
- Custom - Variable is stored in a custom scope
When using Global or Flow scope, the node uses mutex locks to ensure thread-safe operations when multiple executions access the same variable.
Usage Examples
Example 1: Store User Input
Store user input in a message variable for use in subsequent nodes:
- Value:
"John Doe" - Output Scope: Message
- Output Name:
userName
Example 2: Global Configuration
Store a global configuration value that all flows can access:
- Value:
"https://api.example.com" - Output Scope: Global
- Output Name:
apiEndpoint
Example 3: Flow-Level Counter
Store a flow-specific value:
- Value:
"Processing started" - Output Scope: Flow
- Output Name:
status
Tips
- Use Message scope for most cases - it keeps variables attached to the message flow
- Use Global scope sparingly for configuration values that need to be shared across all flows
- Use Flow scope for values that should persist within a single flow execution
- Variable names should be descriptive and follow camelCase convention
- Consider using the ToString node if you need to convert non-string values before assigning
Common Errors and Solutions
Error: Variable not accessible in other nodes
- Solution: Check that the output variable name matches what you're referencing in subsequent nodes
Error: Concurrent access issues
- Solution: The node automatically handles thread safety for Global and Flow scopes using mutex locks
Related Nodes
- ToString - Convert any value to string before assigning
- Concatenate - Combine strings before assigning
- Template - Create formatted strings before assigning