Scoped System API
The ServiceNow Wiki is no longer being updated. Please refer to the Developer Portal for the latest information.
The scoped API defines the set of objects and methods allowed in server-side scripts running in an scoped application. Applications created on the Fuji and subsequent releases are scoped applications and use the scoped API.
The scoped API is available starting with the Fuji release.
|Note: Scripts in the global scope and scripts created prior to the Fuji release can access any method in the comprehensive system API, including GlideRecord, GlideSystem, and GlideElement.|
NEW: For a more browsable version of the scoped API reference, see the newly designed API documentation on the Developer Program site.
2 Core APIs
The following objects are the most commonly used APIs. For a complete list of available APIs listed alphabetically, see List of Scoped Scriptable Objects.
2.1 Core APIs
The following are the core APIs for scoped scripting. These APIs do not need a name space qualifier. For information on logging in scoped applications, see Scoped Script Logging.
| GlideRecord (wiki)
GlideRecord (new site)
|Provides data access APIs to retrieve, update, and delete records from a table.|
|GlideRecordSecure (wiki)||Performs GlideRecord functions and also enforces ACLs.|
| GlideElement (wiki)
GlideElement (new site)
|Provides APIs for dealing with fields and their values. GlideElement methods are available for the fields of the current GlideRecord.|
| GlideSystem (wiki)
GlideSystem (new site)
|Provides APIs to access system information.|
| GlideDateTime (wiki)
GlideDateTime (new site)
|Provides APIs to deal with date time calculations and working with date/time fields.|
| GlideTime (wiki)
GlideTime (new site)
|Provides APIs to deal with time calculations and working with time fields.|
| GlideDate (wiki)
GlideDate (new site)
|Provides APIs to deal with date calculations and working with date fields.|
| GlideDuration (wiki)
GlideDuration (new site)
|Provides APIs to deal with time duration calculations and working with duration fields.|
| GlideUser (wiki)
GlideUser (new site)
|Provides APIs to find information about the current user including their roles.|
| GlideAggregate (wiki)
GlideAggregate (new site)
|Provides data access APIs that are an extension of GlideRecord and provides database aggregation (COUNT, SUM, MIN, MAX, AVG) queries.|
2.2 Core XML APIs
Use these APIs to process an XML document. These APIs do not need a name space qualifier.
| XMLDocument2 (wiki)
XMLDocument2 (new site)
|Object that represents a XML document with functions to access and modify the XML document.|
| XMLNode (wiki)
XMLNode (new site)
|Object that represents a XML element with functions to access and modify the XML element.|
| XMLNodeIterator (wiki)
XMLNodeIterator (new site)
|Use to iterate through elements of an XML node.|
3 API Namespaces
Except for the core APIs, all APIs provided by ServiceNow are separated into different namespaces. This prevents naming collisions from APIs in different modules. This also helps ServiceNow provide new versions of the APIs. All ServiceNow namespaces in scoped applications follow the pattern: “sn_<module name>”. To use these APIs, a fully qualified object name including its namespace is required. For example:
var restMessage = new sn_ws.RESTMessageV2();
|Type||Namespace identifier||Classes included|
|Core APIs||None||GlideAggregate, GlideDate, GlideDateTime, GlideDuration, GlideElement, GlideQueryCondition, GlideRecord, GlideRecordSecure, GlideSchedule, GlideScopedEvaluator, GlideSession, GlideSystem, GlideTableHierarchy, GlideTime, GlideUser, XMLDocument2, XMLNode, XMLNodeIterator|
|Integration APIs||sn_ws||RESTMessageV2, RESTResponseV2, SOAPMessageV2, SOAPResponseV2|
|ServiceNow global script includes and business rules||global||ServiceNow script includes and business rules that are marked as Application = “global” and Accessible from = “All applications"|
Other Java classes are not accessible in scoped scripts.
4 Integration APIs - Namespace: sn_ws
Use these APIs to send a message to a web service provider. You must specify the name space qualifier sn_ws when using these methods, for example : sn_ws.RESTMessageV2.
| RESTMessageV2 (wiki)
RESTMessageV2 (new site)
|Use to send REST messages.|
| RESTResponseV2 (wiki)
RESTResponseV2 (new site)
|Use to view data in the REST message response.|
| SOAPMessageV2 (wiki)
SOAPMessageV2 (new site)
|Use to send a SOAP message.|
| SOAPResponseV2 (wiki)
SOAPResponseV2 (new site)
|Use to view data in the SOAP message response.|