Understanding Step Outputs
Every step in your workflow produces an output that subsequent steps can access. The output structure depends on the step type.Accessing Step Outputs
Use the mustache syntax{{ stepName.property }} to reference data from previous steps:
Step names are automatically generated as
step_1, step_2, etc., but you can rename them to something more meaningful like get_user or send_email.Variable Types
Activepieces supports several types of variables you can use in your workflows:1. Step Outputs
Access data from any previous step:2. Loop Variables
When inside a loop, access iteration data:loop.item
The current item being processed
loop.index
Current iteration number (1-based)
loop.iterations
Array of all completed iterations
3. Connections
Reference saved connection credentials:4. Router/Branch Data
Access branch evaluation results:Using Expressions
Activepieces supports JavaScript expressions within the mustache syntax:String Operations
Number Operations
Array Operations
Object Operations
Data Mapping Examples
Example 1: Transform API Response
1
HTTP Request Step
A step named
fetch_users makes an API call:2
Filter Active Users
Create a code action to filter:Input configuration:
3
Use Filtered Data
Reference the filtered results:
Example 2: Loop Over Items
Example 3: Conditional Data
Use ternary operators for conditional values:Testing Data Flow
When you test a workflow, you can inspect data at each step:- Test Flow
- View Step Output
- Debug Issues
Click Test Flow to run your workflow with sample data.
Sample Data
Steps can save sample data for testing:Sample data is automatically saved when you test individual steps, making it easy to test downstream steps without re-running the entire flow.
Advanced Data Techniques
Working with JSON
Date and Time
Error Handling in Expressions
Common Patterns
Extract Specific Fields
Extract Specific Fields
Extract only the fields you need from a large object:
Merge Multiple Sources
Merge Multiple Sources
Combine data from different steps:
Build Dynamic URLs
Build Dynamic URLs
Construct URLs from variables:
Conditional Field Inclusion
Conditional Field Inclusion
Include fields only if they exist:
Best Practices
- Use Meaningful Step Names: Rename steps to reflect what they do (e.g.,
get_userinstead ofstep_1) - Test Data Flow: Always test with real data to verify expressions work correctly
- Handle Missing Data: Use null coalescing (
??) or defaults for optional fields - Keep Expressions Simple: Complex logic should go in code actions
- Document Complex Mappings: Add notes explaining non-obvious data transformations
Next Steps
Loops & Branches
Learn control flow and conditional logic
Code Actions
Write custom data transformations
Debugging
Debug data flow issues
Error Handling
Handle data errors gracefully