Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.

Widget API reference

Log in to subscribe to topics and get notified when content changes.

Widget API reference

The following client and server side APIs are supported in the Service Portal.

Supported client side APIs

These are the supported Service Portal APIs that can be used in a widget client controller.

For detailed class and method information, see the API reference on the developer portal.

Class Available methods
  • addErrorMessage(String message)
  • addInfoMessage(String message)
  • addTrivialMessage(String message)
  • get(String widgetId)
  • format(String, Object)
  • refresh(Object $scope)
  • recordWatch(Object $scope, String table, String filter, Function callback)
  • Update(Object)
  • alert(String message).then(fn)
  • confirm(String message).then(fn)
  • open(Object options).then(fn)
  • prompt(String message, String default).then(fn)
Note: g_form as a global object cannot be used in a widget client controller or in a UI script.

Supported server side APIs

These are the supported Service Portal APIs that can be used in a widget server script.

Class Available methods
  • canReadRecord(GlideRecord gr)
  • canReadRecord(String table, String sysId)
  • getCatalogItem(String sysId)
  • getCatalogItem(String sysId, Boolean isOrdering)
  • getDisplayValue(String fieldName)
  • getField(GlideRecord gr, String fieldName)
  • getFields(GlideRecord gr, String fieldNames)
  • getFieldsObject(GlideRecord gr, String fieldNames)
  • getForm(String tableName, String sysId)
  • getListColumns(String tableName, String view)
  • getMenuHREF(GlideRecord page)
  • getMenuItems(String sysId)
  • getParameter(String name)
  • getPortalRecord()
  • getRecord()
  • getRecordDisplayValues(Object data, GlideRecord from, String names)
  • getRecordElements(Object data, GlideRecord from, String names)
  • getRecordValues(Object data, GlideRecord from, String names)
  • getStream(String table, String sysId)
  • getUserInitials()
  • getValue(String name)
  • getValues(Object data, String names)
  • getWidget(String sysID, Object options)

Widget properties

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

Server script global objects

Property Description
input An object containing client-side properties set under The value is undefined until the client controller calls c.server.update().
data An object containing properties set during server-side execution.
options An object containing the schema option properties.

Client script global functions

Property Description
this.server.get([Object]) Calls the server and sends custom input. Returns Promise.
this.server.update() Calls the server and posts 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 or AngularJS documentation.