JavaScript & Glide API in ServiceNow

Many people who work with ServiceNow don’t full understand how the platform is modified and managed by admins and developers. Many recruiters, managers and people that rely on ServiceNow – don’t understand how it is …

Newsletter Signup

Want to get better at ServiceNow?
(One email per month)

Many people who work with ServiceNow don’t full understand how the platform is modified and managed by admins and developers.

Many recruiters, managers and people that rely on ServiceNow – don’t understand how it is modified.

There are a lot of people who think that ServiceNow is designed with Java, or that think that Java and JavaScript are the same thing. They are definitely not, and it’s important to understand it.

The software developers that are building ServiceNow, that work at ServiceNow, use Java to build out the platform.

The ServiceNow Admins, Developers and all customers, who use JavaScript to do their job. There is absolutely 0 “Java” being written by ServiceNow customers to modify their instance, only JavaScript.

Scripting in ServiceNow

ServiceNow is customized by ServiceNow Admins and Developers using JavaScript.

ServiceNow has also built out their own little version of JavaScript, commonly referred to as the Glide API.

When you write JavaScript in ServiceNow, it allows you to perform certain database operations without needing to write out SQL queries, add informational messages, configure buttons and customize CRUD operations.

But the JavaScript version of ServiceNow is currently configured with is JavaScript (ECMAScript 5). The newest version of JavaScript was released in 2015, and is known technically as ECMAScript 6.

ECMAScript 6 uses concepts like Const, Let, Promises, etc. – and none of this can be used in ServiceNow.

There are weird little nuances in ServiceNow where you can write ECMAScript 6 in UI Scripts, but not in many other areas.

JavaScript Engine Used By ServiceNow – Rhino Version 1.7 R5 (As of July 2022)

There is a lot of backlash among ServiceNow Developers who want ServiceNow to allow people to use the most up to date JavaScript version on their platform.

If you’re a ServiceNow Professional, you’re simply using an older version of JavaScript. And if you jump to a different tech stack, you likely won’t be able to use it. Most JavaScript jobs are using ECMAScript 6, as they should.

The reasons why you can’t use the most up to date version of JavaScript in ServiceNow are very technical, and have to do with the JavaScript engine that ServiceNow uses to process JavaScript.

You can read up more on ServiceNow’s JavaScript Engine here: https://docs.servicenow.com/en-US/bundle/sandiego-application-development/page/script/JavaScript-engine-upgrade/concept/c_JS_engine_upgrade.html

There are currently no plans that have been announced to allow support for the updated version of JavaScript, in ServiceNow.

If you’re interested in this, here’s the most in-depth community conversation on the whole “supporting new JavaScript in ServiceNow”. Check it out here: https://community.servicenow.com/community?id=view_idea&sysparm_idea_id=fedde80fdb648cd00be6a345ca9619fb&sysparm_idea_table=x_snc_com_ideation_idea&sysparm_module_id=enhancement_requests

So any new JavaScript developer will have a moderately tough time getting used to ServiceNow, because it uses an older version of JavaScript.

GlideRecord and Glide API – ServiceNow’s Version of JavaScript

So we now know that you can use an older version of JavaScript in ServiceNow.

But ServiceNow has also designed their own scripting language, called GlideRecord or the Glide API.

The Glide API is ServiceNow’s proprietary scripting language, that you won’t see outside of ServiceNow. So it’s super custom.

GlideRecord

The GlideRecord class is the most commonly used class in ServiceNow.

The GlideRecord class allows you to create database operations without writing SQL queries. A GlideRecord is an object that contains records from a table.

GlideSystem

You can use this class to get specific information about the system.

Like the current system build, the current URL, add an information message, get specific date related information.

GlideAggregate

The GlideAggregate class is used to perform database aggregation queries, like COUNT, SUM, MIN, MAX, and AVG. It can be used for creating customize reports or calculations in calculated fields.

Go here to checkout the Glide Class and Glide API documentation.

Server and Client Side Scripting

These both use JavaScript (ECMAScript 5).

The idea of client side JavaScript is fairly common, but the concept of server side JavaScript is a bit more difficult to understand.

So the next time you look at a ServiceNow Job posting, and they mention that they need “Java” experience, you should know that they don’t know what they’re talking about.

Don’t be confused by this, it’s an error on their end.

And they probably need your help!

Let us know if you have any questions below.

Leave a Comment