Add Property
Adds a new property with a specified key and value to an object.
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
- Object - The object to add the property to.
- Key - The property key name (string). Cannot be empty.
- Value - The value to assign to the property. Can be any data type (string, number, object, array, boolean, etc.).
Options
This node does not have any options.
Outputs
- Object - The object with the new property added. If the key already exists, its value will be updated.
How It Works
The Add Property node adds or updates a property in an object. When executed, the node:
- Receives an object through the Object input
- Receives a property key name through the Key input
- Receives a value through the Value input
- Validates that the key is not empty
- Adds the property to the object (or updates if it already exists)
- Applies appropriate thread-safety locks for Global or Flow scopes
- Outputs the modified object through the Object output
Requirements
- Valid object as input
- Non-empty string for the key name
- Value can be any valid data type
Error Handling
The node will return specific errors in the following cases:
- ErrInvalidArg - Key is empty or null
- ErrInvalidArg - Object input is invalid
Usage Notes
- If the property key already exists, the value will be updated
- If the property key does not exist, a new property will be created
- The node modifies the original object and returns it
- Global and Flow scope objects are protected with mutex locks for thread-safe updates
- Can add nested objects and arrays as property values
- Useful for building objects incrementally in automation flows
- Can be chained with other Add Property nodes to build complex objects
- Works with objects from any source including API responses, database records, or constructed objects
Example Use Cases
Build Customer Object
Add customer details to an object incrementally:
Create Empty Object →
Add Property (Key: "name", Value: "John Doe") →
Add Property (Key: "email", Value: "john@example.com") →
Add Property (Key: "age", Value: 30) →
Save to Database
Enrich API Response
Add additional data to an API response object:
Get API Response →
Add Property (Key: "processedDate", Value: current_date) →
Add Property (Key: "status", Value: "processed") →
Send Response
Dynamic Property Addition
Add properties based on conditional logic:
Get Object →
Conditional Check →
Add Property (Key: dynamic_key, Value: dynamic_value) →
Continue Processing
Update Configuration
Add or update configuration values:
Load Config Object →
Add Property (Key: "feature_enabled", Value: true) →
Save Config
Tips for Effective Use
- Use descriptive key names following your naming conventions
- Consider using constants or variables for frequently used key names
- Chain multiple Add Property nodes to build complex objects efficiently
- Use Message scope for temporary object modifications
- Use Flow or Global scope when you need to share the modified object across nodes or flows
- Validate your key names to avoid typos or conflicts
- Remember that adding a property with an existing key will update its value