Skip to main content
Transformation actions allow you to process, reshape, and compute values within your workflows. Use these actions when you need custom logic that goes beyond what other actions provide.

javascript

Executes custom JavaScript code with access to all workflow variables. The script must define a servflowRun function that receives the workflow context and returns a result.

Script

The JavaScript code to execute. Must contain a servflowRun function. The servflowRun function receives a vars object containing:
  • Results from previous actions (e.g., vars.fetch_users)
  • Request parameters accessible via the workflow context

Dependencies

Bundled JavaScript dependencies to include with the script.

Example

Basic transformation:

Complex Calculations

Perform calculations on workflow data:

Data Validation

Validate and sanitize input data:

Array Filtering and Sorting

Filter and sort data:

static

Returns a static value or a computed value using template syntax. Useful for setting constants, combining values, or preparing data for subsequent actions.

Return Value

The value to return. Supports template syntax for dynamic values.

Example

Return a constant value:

Combine Values

Combine multiple values into a single result:

Prepare Data

Prepare a JSON structure for another action:

Set Default Values

Provide fallback values using template functions:

When to Use Each

Use static when template syntax is sufficient. Reserve javascript for complex logic that can’t be expressed with templates.

Next Steps

Data Operations

Fetch and store the data you transform.

Flow Control

Run transformations in parallel.

AI Agents

Combine transformations with AI processing.

Actions Overview

Learn the fundamentals of ServFlow actions.