Extend a Script Include

Extend a Script Include

Script Includes can extend existing Script Includes by adding new methods and non-method properties.
Although most ServiceNow classes are extensible, the most commonly extended classes are:
  • GlideAjax: make AJAX calls from Client Scripts
  • LDAPUtils: add managers to users, set group membership, debug LDAP
  • Catalog*: set of classes used by the Service Catalog for form processing and UI building
The generalized Script Include script syntax for extending a class is:
Generalized syntax for extending a Script Include
By convention, but not required, Script Include names start with an uppercase letter and are camel case thereafter. This type of capitalization is sometimes referred to as upper camel case. The Script Include name and the new class name must be an exact match.
If the class being extended is from another scope, prepend the class name with the scope. For example, if NameOfClassYouAreExtending is in the global scope, reference it as global.NameOfClassYouAreExtending in your scoped Script Include.
When creating a Script Include, a template is automatically inserted in the Script field:
The Script Include template
The Script Include template prototype must be modified when extending a Script Include.
Notice that the template includes an initialize function. When extending Script Includes, be careful when overriding methods from the parent class such as the initialize function.