{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":42627,"path":"platform-user-interface/service-portal/widget-api-reference.md","title":"Widget API reference","bundle":null,"doc_type":null,"release":"australia","body":"\n# Widget API reference\n\nService Portal includes client and server side APIs to use in widget client and server scripts.\n\n## Service Portal client-side APIs\n\nThese are Service Portal APIs that you can use in a widget client controller.\n\nSee the API reference for detailed class and method information.\n\n<table id=\"table_skq_rjp_h1b\"><thead><tr><th>\n\nClass\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nspAriaUtil\n\n</td><td>\n\nShows messages on a screen reader.\n\n</td></tr><tr><td>\n\nspContextManager\n\n</td><td>\n\nMakes 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.\n\n</td></tr><tr><td>\n\nspUtil\n\n</td><td>\n\nUtility methods to perform common functions in a Service Portal widget client script.\n\n</td></tr><tr><td>\n\nspModal\n\n</td><td>\n\nShows alerts, prompts, and confirmation dialogs in Service Portal widgets. The spModal class is available in Service Portal client scripts.\n\n</td></tr></tbody>\n</table>**Note:** g\\_form as a global object cannot be used in a widget client controller or in a UI script.\n\n## Service Portal server-side APIs\n\nThese are Service Portal APIs that you can use in a widget server script.\n\n<table id=\"table_sfm_vjp_h1b\"><thead><tr><th>\n\nClass\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nGlideSPScriptable\n\n</td><td>\n\nThe GlideSPScriptable API provides methods to interact with data and perform record operations in Service Portal widgets.\n\n</td></tr><tr><td>\n\nGlideSPSearchAnalytics\n\n</td><td>\n\nThe GlideSPSearchAnalytics API provides methods to generate search analytics from custom ServiceNow search widgets.\n\n</td></tr><tr><td>\n\n\n\n</td><td>\n\nDefines facet items, filters, or mapped queries for a facets object.\n\n</td></tr><tr><td>\n\n\n\n</td><td>\n\nGenerates a multi-choice or single-choice facets object for an advanced search source.\n\n</td></tr><tr><td>\n\n\n\n</td><td>\n\nReturn human-readable URLs for a specific page, or for the current page, based on the transaction request.\n\n</td></tr><tr><td>\n\n\n\n</td><td>\n\nCheck whether a provided table is granted access to a widget to ensure that a widget is securely accessed by an intended audience.\n\n</td></tr></tbody>\n</table>**Parent Topic:**[Developing custom widgets](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-user-interface/service-portal/widget-dev-guide.md)\n\n## Widget properties\n\nGlobal variable and functions available in widget client and server scripts.\n\n### Server script global objects\n\n|Property|Description|\n|--------|-----------|\n|`input`|An object containing client-side properties set under `c.data`. The value is `undefined` until the client controller calls `c.server.update()`.|\n|`data`|An object containing properties set during server-side execution.|\n|`options`|An object containing the schema option properties.|\n\n### Client script global functions\n\n|Property|Description|\n|--------|-----------|\n|`this.server.get([Object])`|Calls the server and sends custom `input`. Returns `Promise`.|\n|`this.server.update()`|Calls the server and posts `this.data` to the server script. Returns `Promise`.|\n|`this.server.refresh()`|Calls the server and automatically replaces the current options and data from the server response. Returns `Promise`.|\n\nA `promise` represents the eventual result of an asynchronous operation. For more information on promises, see [https://promisesaplus.com/](https://promisesaplus.com/) or [AngularJS documentation](https://docs.angularjs.org/api/ng/service/$q).\n\n"}}