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.Documentation Index
Fetch the complete documentation index at: https://docs.servflow.io/llms.txt
Use this file to discover all available pages before exploring further.
javascript
Executes custom JavaScript code with access to all workflow variables. The script must define aservflowRun function that receives the workflow context and returns a result.
Script
The JavaScript code to execute. Must contain aservflowRun function.
| YAML Key | script |
| Type | string |
| Required | Yes |
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.| YAML Key | dependencies |
| Type | string |
| Required | No |
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.| YAML Key | return |
| Type | string |
| Required | Yes |
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
| Scenario | Recommended Action |
|---|---|
| Simple string concatenation | static |
| Setting constant values | static |
| Complex data transformations | javascript |
| Array manipulation (map, filter, reduce) | javascript |
| Conditional logic with multiple branches | javascript |
| Mathematical calculations | javascript |
| Data validation | javascript |
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.