Add custom JavaScript to execute within a reusable action. While most core actions and steps fit common use cases, you can build a Script step to execute behavior not satisfied by the core steps.

Roles and availability

Available as an Workflow Studio action step. Users with the action_designer role can create a custom action with one or more action steps.
Note: Integration Hub See Request Integration Hub for information about Integration Hub usage and subscriptions.

Fields

The Script step includes separate input and output variables that enable you to map JavaScript data to Workflow Studio data. By defining input and output variables within the step, you can define what Workflow Studio data is available within your script, and which scripting variables are available to other steps in your action.

Action error evaluation

If this step fails
Data type: Choice

Option to continue running the next step or go to error evaluation. To use the step status code or message for a custom action error condition, see Action error evaluation.

Example

This example builds a JSON payload that can be easily updated or changed and added to a subsequent REST step.

Note: REST step is not available in the base system and requires the ServiceNow® Integration Hub subscription.

Example Script step in an action.

By creating an output variable that represents the payload, you can drag the [Payload] data pill into the REST step Body field.