- Release notes
- Getting started
- For administrators
- RPA workflow projects
- Creating an RPA workflow from an idea
- Creating a project
- How to start an RPA workflow
- Managing project files and folders
- Connecting RPA workflows to your accounts
- Configuring activities
- Managing the activities in a project
- Passing values between activities
- Iterating through items
- Managing the data in a project
- Configuring a project to use your data
- Using file and folder resources
- App projects
- Agentic processes
- Agents
- Solutions - Preview
- API workflows - Preview

Studio Web User Guide
Script
linkThe Script activity uses JavaScript to enable custom data manipulation within your workflow. It integrates into API workflows, allowing you to:
- Extract, format, and restructure API responses.
- Aggregate and consolidate data.
- Perform calculations and data transformations.
- Standardize data formats for later steps.
Use the Script activity to refine nested or fragmented API responses before passing them to subsequent workflow activities.
Known limitations
link- Limited to data manipulation and cannot directly perform external API requests.
- Runs within the workflow execution context, allowing access only to existing workflow data and step outputs.
Using the Script activity
link- On your API workflow designer canvas, select the plus (+) icon. The Add activity menu appears.
- Select Script.
- In the Properties panel, expand the Expression editor, then write your JavaScript logic in the Code panel.
- Test the workflow to execute the activity and generate output fields for later use.
- Use the
return
statement to efficiently structure JSON outputs. - Use
.map()
to transform arrays into structured objects. - Use Autopilot expression generator to automatically generate JavaScript based on workflow context, minimizing manual coding effort.
Script activity example
linkThe following example consolidates data from multiple workflow steps into a structured JSON object using the Script activity. This approach is especially helpful with Workday APIs, which often require several endpoint calls to retrieve complete datasets, such as employee details, managers, and direct reports.
Open the Debug configuration window, then paste and save the following JSON syntax:
{
"first_name": "Betty",
"last_name": "Liu"
}
{
"first_name": "Betty",
"last_name": "Liu"
}
- On your API workflow designer canvas, add a Script activity.
- Open the Expression editor and paste the following implementation:
return { // Details on the worker worker: { name: $currentItem.descriptor, email: $currentItem.person.email }, // Details of their manager manager: { name: $context.outputs.Workers_3.content.descriptor, email: $context.outputs.Workers_3.content.person.email }, // Details for their direct reports reports: $context.outputs.Workday_REST_HTTP_Request_4.content.data.map(report => ({ name: report.descriptor, email: report.primaryWorkEmail })) }
return { // Details on the worker worker: { name: $currentItem.descriptor, email: $currentItem.person.email }, // Details of their manager manager: { name: $context.outputs.Workers_3.content.descriptor, email: $context.outputs.Workers_3.content.person.email }, // Details for their direct reports reports: $context.outputs.Workday_REST_HTTP_Request_4.content.data.map(report => ({ name: report.descriptor, email: report.primaryWorkEmail })) }
- Using
$context.outputs
to retrieve data from previous API calls. - Using
.map()
to transform arrays into structured lists of reports. - Combining multiple API responses into a single JSON object.