Skip to main content

Assign

Assigns an object value to a variable with configurable scope.

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.

Inputs

  • Value - Object value to assign. Can be a variable reference, JavaScript expression, or object literal.

Options

This node does not have any options.

Outputs

  • Object - The assigned object result stored in the specified variable scope.

How It Works

The Assign node assigns an object value to a variable with thread-safe scope management. When executed, the node:

  1. Receives an object value through the Value input
  2. Validates that the input value is not null
  3. Applies appropriate thread-safety locks for Global or Flow scopes
  4. Assigns the object to the output variable in the specified scope
  5. Outputs the assigned object through the Object output

The node supports multiple variable scopes:

  • Message - Variable exists only within the current message context
  • Flow - Variable shared across all nodes in the flow (thread-safe)
  • Global - Variable shared across all flows in the robot (thread-safe)
  • Local - Variable scoped to the current node execution
  • Custom - Custom variable scope defined by the user

Requirements

  • Valid object value as input (cannot be null)

Error Handling

The node will return specific errors in the following cases:

  • ErrInvalidArg - Input object is null or undefined

Usage Notes

  • Use this node to store objects in variables for later use in your automation flow
  • The node automatically wraps JavaScript object literals in parentheses to ensure proper parsing
  • Global and Flow scopes use mutex locks to ensure thread-safe concurrent access
  • Message scope is the most common choice for temporary object storage within a flow
  • Global scope is useful when you need to share object data across multiple flows
  • Flow scope is ideal for sharing object data across nodes in the same flow execution
  • Can accept objects from various sources including API responses, database queries, or constructed objects
  • Useful as the starting point for object manipulation workflows
  • Combine with other Object nodes to build complex data transformation pipelines

Example Use Cases

Store API Response

Assign a JSON response from an API call to a flow variable for processing:

API Request → Assign (Flow scope) → Process data in multiple nodes

Share Configuration Object

Store a configuration object in Global scope to be used across multiple flows:

Load Config → Assign (Global scope) → Access config in any flow

Create Temporary Object

Store a constructed object in Message scope for immediate processing:

Create Object → Assign (Message scope) → Add Properties → Use in next node