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

Automated Service Portal test steps

Automated Service Portal test steps

Service Portal administrators can write automated steps to test portal forms, fields, and UI actions.

Creating automated Service Portal steps requires knowledge of the ServiceNow data model and Service Portal form and data structures.

Open a Form (SP)

Opens a form in a portal.

Field Description
Execution order Integer specifying the order in which the step executes within the series of steps.
Active Whether the step is active.
Application Application scope that the step runs in. This field is read-only.
Test Test that the step belongs to. This field is read-only.
Step config Current test step. This field is read-only.
Portal Portal in which the defined form opens. Service Portal is the default.
Page Page to open in the defined portal. The form page is the default.
Table Table for the form to open.
sys_id sys_id of the record to open. Default is -1, which opens a new record.
View The form view to open. If blank, the default view is used.
Query parameters Additional URL query parameters for the form.

Set Field Values (SP)

Sets the values of fields in a form. To use this step, you must have already opened a form using the Open a Form (SP) test step.

Field Description
Execution order Integer specifying the order in which the step executes within the series of steps.
Active Whether the step is active.
Application Application scope that the step runs in. This field is read-only.
Test Test that the step belongs to. This field is read-only.
Step config Current test step. This field is read-only.
Table The table for the form on which to set field values. The value should be the table in the Open a Form (SP) step.
Field values Field values to be set. Set values for multiple fields.

Field Values Validation (SP)

Validates field values on the current form based on defined conditions. To use this step, you must have already opened a form using the Open a Form (SP) test step.

Field Description
Execution order Integer specifying the order in which the step executes within the series of steps.
Active Whether the step is active.
Application Application scope that the step runs in. This field is read-only.
Test Test that the step belongs to. This field is read-only.
Step config Current test step. This field is read-only.
Table The table for the form on which to validate fields. The value should be the table in the Open a Form (SP) step.
Conditions Define conditions to validate one or more fields on the form. If the condition evaluates to true, the step passes.

Field State Validation (SP)

Validates field states on a form in Service Portal.

Field Description
Execution order Integer specifying the order in which the step executes within the series of steps.
Active Whether the step is active.
Application Application scope that the step runs in. This field is read-only.
Test Test that the step belongs to. This field is read-only.
Step config Current test step. This field is read-only.
Table The table for the form on which to validate field states. The value should be the table in the Open a Form (SP) step.
Visible Checks if the selected fields are visible on the form. If they are not, the step fails.
Read only Checks if the selected fields are read-only. If they are not, the step fails.
Not read only Checks if the selected fields are not read-only. If they are, the step fails.
Mandatory Checks if the selected fields are mandatory. If they are not mandatory, the step fails.
Not mandatory Checks if the selected fields are not mandatory. If they are mandatory, the step fails.

UI Action Visibility Validation (SP)

Determines whether a UI action on the current Service Portal form is visible. To use this step, you must have already opened a form using the Open a Form (SP) test step.

Note: Service Portal only supports server UI Actions. The setRedirectURL() method and client UI Actions are not supported. UI Action visibility can vary depending on the currently logged in or impersonated user.
Field Description
Execution order Integer specifying the order in which the step executes within the series of steps.
Active Whether the step is active.
Application Application scope that the step runs in. This field is read-only.
Test Test that the step belongs to. This field is read-only.
Step config Current test step. This field is read-only.
Table The table for the form on which to check visibility. The value should be the table in the Open a Form (SP) step.
Visible Select fields from the UI Actions table to check whether they are visible on the form for the currently logged in user. Only includes form-based UI actions.
Note: If the list contains UI actions with the same name, check the form to determine the Sys ID of the element. Then, filter by Sys ID in the UI Action table to select the correct element in the step.
Not visible Select fields from the UI Actions table to check whether they are not visible on the form for the currently logged in user. Only includes form-based UI actions.
Note: If the list contains UI actions with the same name, check the form to determine the Sys ID of the element. Then, filter by Sys ID in the UI Action table to select the correct element in the step.

Click a UI Action (SP)

Selects a UI Action on the current Service Portal form and outputs the table and Sys ID of the record on which the action was selected.

To use this step, you must have already opened a form using the Open a Form (SP) test step. After using this step, no other form steps can be used.

Field Description
Execution order Integer specifying the order in which the step executes within the series of steps.
Active Whether the step is active.
Application Application scope that the step runs in. This field is read-only.
Test Test that the step belongs to. This field is read-only.
Step config Current test step. This field is read-only.
Table The table for the form on which to check visibility. The value should be the table in the Open a Form (SP) step.
UI Action Select a UI action to click from the UI Actions table. Only includes form-based UI actions.
Assert type Where to check for form submission after clicking the UI action.
  • None: Selects the UI action without validating mandatory or other fields.
  • Form submission canceled in browser: Checks whether the form was canceled in the browser and did not reach the server due to validation or other issues.
  • Form submitted to server: Checks if the form was submitted to the server.

Submit a Form (SP)

Submits the current form in a Service Portal page and outputs the table and sys_id of the submitted record.

To use this step, you must have already opened a form using the Open a Form (SP) test step. After using this step, the page closes. You cannot use any other steps on the current page.

Field Description
Execution order Integer specifying the order in which the step executes within the series of steps.
Active Whether the step is active.
Application Application scope that the step runs in. This field is read-only.
Test Test that the step belongs to. This field is read-only.
Step config Current test step. This field is read-only.
Assert type Where to check for form submission.
  • None: Submits the form without validating mandatory or other fields.
  • Form submitted to server: Checks if the form was submitted to the server.
  • Form submission canceled in browser: Checks whether the form was canceled in the browser and did not reach the server due to validation or other issues.