Vancouver API Reference
Vancouver API
Reference
Last updated: January 16, 2024
PDF generated on January 16, 2024
©2024 ServiceNow. All rights reserved. Terms of Use Privacy Statement
ServiceNow, the ServiceNow logo, Now, and other ServiceNow marks are trademarks and/or registered trademarks of ServiceNow, Inc., in
the United States and/or other countries. Other company and product names may be trademarks of the respective companies with which
they are associated.
Vancouver API Reference
Some examples and graphics depicted herein are provided for
illustration only. No real association or connection to ServiceNow
products or services is intended or should be inferred.
This PDF was created from content on docs.servicenow.com. The web
site is updated frequently. For the most current ServiceNow product
documentation, go to docs.servicenow.com.
Company Headquarters
2225 Lawson Lane
Santa Clara, CA 95054
United States
(408)501-8550
PDF generated on January 16, 2024 2
©2024 ServiceNow. All rights reserved. Terms of Use Privacy Statement
ServiceNow, the ServiceNow logo, Now, and other ServiceNow marks are trademarks and/or registered trademarks of ServiceNow, Inc., in the
United States and/or other countries. Other company and product names may be trademarks of the respective companies with which they are
associated.
Vancouver API Reference
Scripting
Use scripts to extend your instance beyond standard configurations. With
scripts, you may automate processes, add functionality, integrate your
instance with an outside application and more.
APIs (Application Programming Interfaces) provide classes and methods
that you can use in scripts to define functionality. ServiceNow provides
APIs as JavaScript classes, web services, and other points of connection
for integrations. Note that you cannot access commonly used JavaScript
objects (such as DOM or Window). Jelly scripts are also used in some
modules. Jelly is used to turn XML into HTML and may include both client-
side and server-side scripts.
Scripts may be server-side (run on the server or database), client-side (run
in the user's browser), or run on the MID server.
Note: When you are writing scripts, you cannot use reserved words.
Understand JavaScript before you begin customizing your instance, and
with Jelly if you intend to deploy Jelly scripts.
Server-side scripts
Perform database operations. For example, use a server-side script to
update a record. Create a script in a scoped application or in the global
scope. Each execution context includes a set of available APIs.
Scoped environment
Use scoped APIs when scripting in a scoped application. Scoped Glide
APIs do not include all the methods included in the global Glide APIs, and
you cannot call a global Glide API in a scoped application.
Global environment
The global scope is a special application scope that identifies
applications developed prior to application scoping, or applications
intended to be accessible to all other global applications. Use global
APIs when scripting in the global scope.
PDF generated on January 16, 2024 3
©2024 ServiceNow. All rights reserved. Terms of Use Privacy Statement
ServiceNow, the ServiceNow logo, Now, and other ServiceNow marks are trademarks and/or registered trademarks of ServiceNow, Inc., in the
United States and/or other countries. Other company and product names may be trademarks of the respective companies with which they are
associated.
Vancouver API Reference
To learn more about server-side scripting, see Server-side scripting. To
learn more about application scope, see Application scope.
Client-side scripts
Make changes to the appearance of forms, display different fields based
on values that are entered, or change other custom display options.
• onLoad client scripts run when the form or page is loaded
• onChange client scripts run when something specific gets changed
AND also when the form or page loads
• onSubmit client scripts run when the form is submitted
Client Scripts can also be called by other scripts or modules, including
UI policies. To learn more about client-side scripting, see Client-side
scripting.
• Available script types
Scripts can be used in many places. The most important detail is
whether the script runs on the client or the server.
• Glide class overview
The ServiceNow Glide classes expose JavaScript APIs that enable you
to conveniently work with tables using scripts.
• Execution order of scripts and engines
Scripts, assignment rules, business rules, workflows, escalations, and
engines all take effect in relation to a database operation, such as
insert or update. In many cases, the order of these events is important.
• Script evaluation of fields by data type
Script fields evaluate data based on the field type of the input.
• Scripting alert, info, and error messages
You can send messages to customers as alerts, informational messages,
or error messages.
• Using regular expressions in server-side scripts
PDF generated on January 16, 2024 4
©2024 ServiceNow. All rights reserved. Terms of Use Privacy Statement
ServiceNow, the ServiceNow logo, Now, and other ServiceNow marks are trademarks and/or registered trademarks of ServiceNow, Inc., in the
United States and/or other countries. Other company and product names may be trademarks of the respective companies with which they are
associated.
Vancouver API Reference
JavaScript regular expressions automatically use an enhanced regex
engine, which provides improved performance and supports all
behaviors of standard regular expressions as defined by Mozilla
JavaScript. The enhanced regex engine supports using Java syntax in
regular expressions.
• JavaScript syntax editor
The syntax editor provides support for editing JavaScript scripts.
• HTML syntax editor
The HTML syntax editor provides support for editing HTML and Jelly
scripts and defines what's rendered when the page is displayed. The
HTML syntax editor can contain either static XHTML or dynamically
generated content defined as Jelly, and can call script includes and
UI Macros.
• Code editor
The code editor provides support to use programming language
services in a text editor and is used in scripts.
• Server-side scripting
Server scripts run on the server or database. They can change the
appearance or behavior of ServiceNow or run as business rules when
records and tables are accessed or modified.
• Client-side scripting
Run JavaScript on the client (web browser) when client-based events
occur, such as when a form loads, after form submission, or when a field
changes value.
• Useful scripts
Scripts that provide useful functionality not included in the core system.
• Creating custom UI Pages and UI macros
Use UI pages to create custom pages for an application and UI macros
for custom controls or interfaces.
• Debugging scripts
PDF generated on January 16, 2024 5
©2024 ServiceNow. All rights reserved. Terms of Use Privacy Statement
ServiceNow, the ServiceNow logo, Now, and other ServiceNow marks are trademarks and/or registered trademarks of ServiceNow, Inc., in the
United States and/or other countries. Other company and product names may be trademarks of the respective companies with which they are
associated.
Vancouver API Reference
Debug scripts using session logs and Now Platform debugging tools
such as a walk-through script debugger and error messages that
display in the UI.
• Packages Call Removal tool
The Packages Call Removal Tool provides modules to identify fields
that might contain scripts, find scripts that contain Packages calls to
ServiceNow Java classes, and to examine proposed script changes
that eliminate those Packages calls.
PDF generated on January 16, 2024 6
©2024 ServiceNow. All rights reserved. Terms of Use Privacy Statement
ServiceNow, the ServiceNow logo, Now, and other ServiceNow marks are trademarks and/or registered trademarks of ServiceNow, Inc., in the
United States and/or other countries. Other company and product names may be trademarks of the respective companies with which they are
associated.