Extend an Existing Class
- Create a new Class to store new function
- Reference an existing Class using the extendsObject() method
var MyNewUtil = Class.create();
MyNewUtil.prototype = Object.extendsObject(ExistingClassNameGoesHere, {
type: 'MyNewUtil'
});
Extending a Class means to add functionality ( typically in the form of methods) to an existing Class without modifying the original script.
Create a New Script Include/Class, reference an existing Class using the extendsObject() method to include all its functionality, add script logic.
Commonly extended ServiceNow Classes:
- AbstractAjaxProcessor: makes AJAX calls from Client Scripts.
- LDAPUtils: used by LDAP integration to ServiceNow (e.g. adding Managers to users, managing group membership, debug logging).
- Catalog*: set of Classes used for Service Catalog management (e.g. UI building, Form processing).