Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Script step

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.

Note: The IntegrationHub plugin further enhances the Script step to enable you to create integrations with external systems.

Roles and availability

  • Available as an Action Designer action step. Subject matter experts use the action_designer role to create a custom action with one or more action steps.

Fields

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

Field Description
Input variables Name-value pairs that represent data from the action, enabling you to use action inputs and data from other steps within a script.
Script

Script that executes within the action. To access input and output variables in your script, use the global objects inputs and outputs. For example, inputs.myVariable.

Scripts in Flow Designer execute on the server. For available classes and methods, see JavaScript API reference.

Output variables Map JavaScript output to Flow Designer data pills. Define output variables when you want other steps in the action to use the script output.

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 on base systems and requires the IntegrationHub plugin.

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