Widget Server Script

This is where you put the server-side logic for your widget. This is helpful primarily with interacting with the Glide platform through server-side APIs.

As the API reference might suggest, this section is only for pro code users with an understanding of AngularJS and ServiceNow APIs

For example, the stock widget uses the following server script:
data.typeSymbolMsg = gs.getMessage("Type stock symbol");
if (input) {
    var r = new RESTMessage('Yahoo Finance', 'get');
    r.setStringParameter('symbol', input.symbol);
    var response = r.execute();
    data.price = response.getBody();
Table 1. Server-side properties and helpers
Property Description
input An object containing client-side properties set under c.data. It will have an undefined value until the client-side controller calls c.server.update()
data An object containing properties set during server-side execution
options An object containing the schema option properties
$sp Helper class used to access server script API.

Learn more: GlideSPScriptable