Set
The Set node allows you to create or modify data objects by setting one or more key-value properties. This is essential for data preparation, object construction, and adding metadata to workflow data in logistics operations.
Overview
The Set node is essential when you need to:
- Create data objects - Build structured data from individual values
- Add metadata - Attach timestamps, processing flags, or tracking information
- Restructure data - Reorganize data into different object formats
- Set default values - Add missing properties with default values
- Combine data sources - Merge values from multiple workflow nodes
- Prepare API payloads - Structure data for external API calls
Configuration
Key-Value Properties
Define one or more properties to set on the output object:
- Property Key - The name of the property to set
- Property Value - The value to assign (can be static or from workflow data)
- Data Type - Automatic detection or explicit type specification
- Dynamic Keys - Use workflow data to determine property names
- Nested Properties - Set properties on nested objects using dot notation
Value Sources
Property values can come from various sources:
- Static values - Fixed text, numbers, or boolean values
- Workflow data - Values from previous nodes using variable references
- Expressions - Calculated values using simple expressions
Output Behavior
Object Creation
- New object - Creates a fresh object with only the specified properties
- Type preservation - Maintains appropriate data types for each property
- Nested structure - Supports creating nested object hierarchies
Example Usage
Data Restructuring
Input: Shipment data from API
Properties:
tracking_number: {{data.trackingId}}
current_status: {{data.status}}
last_updated: {{data.lastScanTime}}
carrier: "FedEx"
priority: "standard"
Output: Standardized shipment object
Metadata Addition
Input: Customer order data
Properties:
order_id: {{data.orderId}}
customer_name: {{data.customer.name}}
total_amount: {{data.total}}
processing_date: {{currentDate}}
workflow_version: "v2.1"
processed: true
Output: Order with processing metadata
API Payload Preparation
Properties:
shipment: {
tracking_number: {{data.trackingNumber}},
status: {{data.currentStatus}},
location: {{data.lastLocation}}
}
notification: {
email: {{data.customerEmail}},
sms: {{data.customerPhone}}
}
options: {
send_email: true,
send_sms: false,
include_history: true
}
Output: Structured payload for notification API
Advanced Patterns
Nested Object Construction
Properties:
customer.id: {{data.customerId}}
customer.name: {{data.customerName}}
customer.tier: {{data.customerTier}}
shipping.address: {{data.shippingAddress}}
shipping.method: {{data.shippingMethod}}
shipping.cost: {{data.shippingCost}}
Output: Nested customer and shipping objects
Data Transformation
Input: Raw API response
Properties:
id: {{data.shipment_tracking_number}}
status: {{data.current_shipment_status}}
location: {{data.last_known_location}}
updated: {{data.status_update_timestamp}}
carrier_code: {{data.shipping_carrier_identifier}}
Output: Transformed to standard format
Best Practices
Property Design
- Use consistent naming - Follow standard naming conventions (camelCase, snake_case)
- Meaningful keys - Choose descriptive property names
- Type consistency - Maintain consistent data types for similar properties
Value Management
- Validate inputs - Ensure source data exists before referencing
- Null handling - Decide whether to include or exclude null properties
- Data sanitization - Clean and validate values before setting
Performance
- Minimize properties - Only set necessary properties
- Efficient references - Use direct data references when possible
- Avoid deep nesting - Keep object structures reasonably flat
- Memory usage - Be mindful of large objects and arrays
Common Use Cases
Data Standardization
Convert various input formats to a standard structure:
API Response → Set Node → Standardized Object → Database Storage
Workflow Metadata
Add processing information to data objects:
Input Data → Set Node (add timestamps/flags) → Enhanced Data → Next Processing Step
API Request Preparation
Structure data for external API calls:
Workflow Data → Set Node → API Payload → HTTP Request → External System
Report Data Assembly
Combine data from multiple sources for reporting:
Multiple Data Sources → Set Node → Report Object → Generate Report
Configuration Objects
Create configuration objects for other workflow nodes:
User Inputs → Set Node → Configuration Object → Configurable Process
Integration Patterns
With Code Nodes
Use Set nodes to prepare clean data for Code node processing:
Raw Data → Set Node (structure) → Code Node (complex logic) → Output
With HTTP Requests
Structure request payloads for API calls:
Workflow Data → Set Node (format payload) → HTTP Request → API Response
With Conditional Logic
Create objects with conditional properties:
Input Data → If Node → Set Node (conditional properties) → Structured Output
With Loops
Set properties for each item in a collection:
Array Input → Loop → Set Node (per item) → Collect Results → Array Output
Troubleshooting
Common Issues
- Missing references - Ensure referenced workflow data exists
- Type mismatches - Verify data types match expectations
- Invalid property names - Ensure property keys are valid identifiers
Debugging Tips
- Test with simple values - Start with static values before using dynamic references
- Check data sources - Verify that referenced data is available and correct
- Validate output structure - Ensure the resulting object has the expected format
- Monitor property types - Check that values have the correct data types
Validation
- Required properties - Ensure all necessary properties are set
- Data completeness - Verify that all expected values are present
- Format consistency - Check that similar objects have consistent structure
- Null value handling - Confirm null values are handled appropriately
The Set node is fundamental for data preparation and object construction in logistics workflows, enabling clean data structuring and metadata management.