Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

Widget API reference

Service Portal includes client and server side APIs to use in widget client and server scripts.

Service Portal client-side APIs

These are Service Portal APIs that you can use in a widget client controller.

See the API reference for detailed class and method information.

ClassDescription
spAriaUtilShows messages on a screen reader.
spContextManagerMakes data from a Service Portal widget available to other applications and services in a Service Portal page. For example, pass widget data to Agent Chat when it opens in a Service Portal page.
spUtilUtility methods to perform common functions in a Service Portal widget client script.
spModalShows alerts, prompts, and confirmation dialogs in Service Portal widgets. The spModal class is available in Service Portal client scripts.

Note: g_form as a global object cannot be used in a widget client controller or in a UI script.

Service Portal server-side APIs

These are Service Portal APIs that you can use in a widget server script.

ClassDescription
GlideSPScriptableThe GlideSPScriptable API provides methods to interact with data and perform record operations in Service Portal widgets.
GlideSPSearchAnalyticsThe GlideSPSearchAnalytics API provides methods to generate search analytics from custom ServiceNow search widgets.
SPScriptedFacet - ScopedDefines facet items, filters, or mapped queries for a facets object.
SPScriptedFacetService - ScopedGenerates a multi-choice or single-choice facets object for an advanced search source.
SPSEOUtilsSNC - GlobalReturn human-readable URLs for a specific page, or for the current page, based on the transaction request.
SPWidgetAccessControl - GlobalCheck whether a provided table is granted access to a widget to ensure that a widget is securely accessed by an intended audience.

Parent Topic:Developing custom widgets

Widget properties

Global variable and functions available in widget client and server scripts.

Server script global objects

PropertyDescription
inputAn object containing client-side properties set under c.data. The value is undefined until the client controller calls c.server.update().
dataAn object containing properties set during server-side execution.
optionsAn object containing the schema option properties.

Client script global functions

PropertyDescription
this.server.get([Object])Calls the server and sends custom input. Returns Promise.
this.server.update()Calls the server and posts this.data to the server script. Returns Promise.
this.server.refresh()Calls the server and automatically replaces the current options and data from the server response. Returns Promise.

A promise represents the eventual result of an asynchronous operation. For more information on promises, see https://promisesaplus.com/ or AngularJS documentation.