GlideRecord

One of the most common JavaScript APIs is the GlideRecord class, which is extremely handy and will fast become a staple of most scripting. GlideRecord is a way of finding and counting records in ServiceNow based on many different queries. It is quite similar to a SQL statement if that is something you are familiar with.

Let's have a look at how to use GlideRecord.

We'll take a look at how to query all the records in a particular table. The format of the GlideRecord script for this is shown in the following, with table_name being the only parameter. This needs to be the table name rather than the table label:

new GlideRecord('<table_name>');

We will set a variable to hold the GlideRecord object and define the table that will be ...

Get Mastering ServiceNow Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.