Use the Script component

task australia Updated Sep 10, 2026 1 min read use-general-script.md
Raw file servicenow.com

Write and execute custom Visual Basic (VB) scripts by using the Script component in RPA Desktop Design Studio.

Before you begin

Role required: none

About this task

You can configure the properties for the Script component. For more information about these properties, see Properties of the General components.

You can use this component to perform actions that are not covered by existing RPA components or combine actions of multiple components.

For example, you can retrieve a substring from a string by using the VB script in the Script component. You can specify the string and the start character position.

[Omitted image "general-script-rpa.png"] Alt text: VB script with the string specified and the start character position in the Script component.

Procedure

  1. In the Toolbox pane, navigate to General > Script.

  2. Drag the Script component to the Design surface.

  3. Click the component settings icon ([Omitted image "component-settings-icon.png"] Alt text: Component settings icon.).

  4. Under the SCRIPT (VB.NET) heading, enter the custom VB script.

  5. To add parameters to the script, do the following steps.

    1. Click the add parameter icon ([Omitted image "add-image-icon.png"] Alt text: Add parameter icon.).

    2. Update the data type of the parameter.

    3. Repeat the steps to add more parameters.

    A Data In Port is added with each parameter you add.

  6. To set the output data type, under the RETURN TYPE heading, select the data type.

  7. To validate the script, click Validate.

    Errors, if any, are shown in the ERRORS section. You must fix all errors before proceeding.

  8. Click OK to close the SCRIPT EDITOR window.

  9. Connect the data and control ports of the Script component to the corresponding ports of the other component as described in the following table.

Port name

Description

Port type

Mandatory?

Parameter

Enter a value for the parameter or use the value from a previously executed component.

Data In

No. Connecting this port is optional.

Return

Returns the output of the script and passes to the next component.

Data Out

Yes.To view the output, right-click the Return field and click Preview Data.

10. To test the component, under the **DESIGN** tab, click **Run**.

Parent Topic:General

Search documentation
Search document titles and file paths on the australia branch