Set Value
Controlled node
Overview
The Set Value node modifies an object or list by setting a value at a specific path. It supports nested properties using dot notation (e.g., user.profile.name) and array indices (e.g., users.0 or 0). The node mutates the input object in-place and outputs the modified object.
This is useful for updating specific fields in complex data structures, appending to arrays, or modifying nested dictionary values within a workflow.
This node modifies the input object directly. The output newObject is the same object reference as the input, with the value updated at the specified path.
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Run | Event | Fires when the node starts running | - |
| Object | Data | The object, dictionary, or list to modify | - |
| Path | Text | The path to the property to set. Use dot notation for nested objects (e.g., user.name) or numbers for array indices (e.g., 0 or items.2) | - |
| Value | Data | The value to set at the specified path | - |
Outputs
| Output | Type | Description |
|---|---|---|
| Done | Event | Fires when the node has finished |
| New Object | Data | The modified object (same reference as input) |
Runtime Behavior and Defaults
Path Resolution
The node parses the Path input to navigate the object structure:
- Dot notation:
user.profile.nameaccessesobject.user.profile.name - Array indices:
users.0accesses the first element ofobject.users - Mixed:
data.0.valueaccessesobject.data[0].value
Array Operations
- Existing indices: Setting
users.1updates the second element - Appending: Setting
users.2on an array of length 2 appends a new element at index 2 - Out of bounds: Throws an error if the index is negative or exceeds the array length (for setting existing indices)
Error Conditions
The node will throw an error if:
- The Path is empty or invalid
- An array index is out of range (negative or greater than length when accessing)
- A property key doesn't exist in a non-array object (when traversing intermediate paths)
Example Usage
Setting a nested property:
// Input Object: { user: { name: "John", age: 30 } }
// Path: "user.name"
// Value: "Jane"
// Output: { user: { name: "Jane", age: 30 } }
Updating an array element:
// Input Object: { items: ["apple", "banana", "cherry"] }
// Path: "items.1"
// Value: "blueberry"
// Output: { items: ["apple", "blueberry", "cherry"] }
Appending to an array:
// Input Object: { tags: ["urgent", "review"] }
// Path: "tags.2"
// Value: "approved"
// Output: { tags: ["urgent", "review", "approved"] }
Setting a top-level array element:
// Input Object: ["red", "green", "blue"]
// Path: "0"
// Value: "yellow"
// Output: ["yellow", "green", "blue"]