Configure the JavaScript connector

  • Freigeben Version: Australia
  • Aktualisiert 12. März 2026
  • 1 Minute Lesedauer
  • Configure the JavaScript connector by writing custom script and validating custom classes and functions. Then you execute the script by providing values for the functions.

    Vorbereitungen

    Ensure you have installed the Scripting plugin on the RPA Desktop Design Studio. To install, see Manage plugins in RPA Desktop Design Studio.

    Role required: Developer

    Prozedur

    1. In the Toolbox pane, navigate to Connectors > JavaScript .
    2. Drag the JavaScript connector to Global Objects in the Project Explorer pane.
    3. Right-click the JavaScript connector in Global Objects and select Configure.
      The Script Editor window is displayed.
    4. Enter the custom JavaScript in the Script pane.
      Abbildung : 1. Script pane in Script Editor
      Script pane in Script Editor
    5. Wahlweise: Use the ServiceNow® Now Assist for code generation application as part your automation by using the Generate code button.
      Use this button to generate AI code to write custom scripts quickly. The code is generated from a prompt based input.
      Abbildung : 2. Generate code button and prompt in Script Editor
      Generate code button and prompt in Script Editor
      To generate AI code, do the following steps:
      1. Enter the input text in the prompt. Ensure that you provide a meaningful text input to generate the code of your choice. For example, generate code to find the process ID of an application.
      2. Select Generate code. The JavaScript code is generated in the Script pane as per your input.
        Abbildung : 3. Input text to generate code
        Input text to generate code
      Hinweis:
      If you are not connected to an instance and select Generate code, a No instance is connected message displayed.
    6. Select Validate.
      If your custom script has any errors, it is displayed in the Errors pane. Resolve the errors and select Validate to check for errors again.
      Abbildung : 4. Error pane for Script Editor
      Error pane for Script Editor
    7. Click OK.
      If you want to save the changes, select Yes. An error validation is performed again and the changes are saved. If you want to discard the changes, select No.

    Nächste Maßnahme

    The custom script you created by using the JavaScript connector is now ready to be used in your automation.