Skip to main content
One of the most powerful features in Activepieces is the ability to pass data between steps. This guide explains how to reference step outputs, use expressions, and map data throughout your workflow.

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:
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 only the fields you need from a large object:
Combine data from different steps:
Construct URLs from variables:
Include fields only if they exist:

Best Practices

  1. Use Meaningful Step Names: Rename steps to reflect what they do (e.g., get_user instead of step_1)
  2. Test Data Flow: Always test with real data to verify expressions work correctly
  3. Handle Missing Data: Use null coalescing (??) or defaults for optional fields
  4. Keep Expressions Simple: Complex logic should go in code actions
  5. 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