Glide Record.

redijanirud
Giga Contributor

What is a glide record in servicenow?

3 ACCEPTED SOLUTIONS

VedS
Mega Guru

Hello @redijanirud ,

This is the official documentation which you can refer to 
https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/new_to_servicenow/app_store_le...

https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc...

Please mark this as "correct" and "helpful" if you feel this answer helped you in anyway.

 

Thanks and Regards,

Ved

View solution in original post

J Siva
Tera Sage

Hi @redijanirud 
Check the ServiceNow article below, which provides an explanation..
GlideRecord

Regards,
Siva

View solution in original post

Pooja Limbani
Giga Guru

Hi @redijanirud 

Please refer :

https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/new_to_servicenow/app_store_le...

 

In ServiceNow, a GlideRecord is a special JavaScript class used to interact with the database. It allows you to query, update, insert, or delete records in any table in ServiceNow, similar to how you would use SQL in traditional databases.

 

Simple Real-Time Example :

Let’s say you work in IT support and want to find all open incidents assigned to you.

You want to get all incidents where:

  • The state is not "Closed"
  • Assigned to your user ID

GlideRecord Script:

var gr = new GlideRecord('incident'); // Targeting the 'incident' table
gr.addQuery('state', '!=', '7'); // State not equal to 'Closed' (state 7 = Closed)
gr.addQuery('assigned_to', gs.getUserID()); // Assigned to current user
gr.query(); // Run the query

while (gr.next()) {
gs.info('Incident Number: ' + gr.number); // Print incident number
}

 

Imagine you're an Infra Dev Specialist and want to automate a script that checks for stale incidents (e.g., not updated in 7 days). GlideRecord helps you fetch those records and take action—like sending reminders or escalating.

 

Help future readers out—mark the answer and close the thread if it helped you! ðŸ˜Š


If this response resolved your issue, kindly mark it as Helpful or Accept Solution—it helps others find the answer faster.

View solution in original post

5 REPLIES 5

VedS
Mega Guru

Hello @redijanirud ,

This is the official documentation which you can refer to 
https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/new_to_servicenow/app_store_le...

https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc...

Please mark this as "correct" and "helpful" if you feel this answer helped you in anyway.

 

Thanks and Regards,

Ved

J Siva
Tera Sage

Hi @redijanirud 
Check the ServiceNow article below, which provides an explanation..
GlideRecord

Regards,
Siva

Pooja Limbani
Giga Guru

Hi @redijanirud 

Please refer :

https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/new_to_servicenow/app_store_le...

 

In ServiceNow, a GlideRecord is a special JavaScript class used to interact with the database. It allows you to query, update, insert, or delete records in any table in ServiceNow, similar to how you would use SQL in traditional databases.

 

Simple Real-Time Example :

Let’s say you work in IT support and want to find all open incidents assigned to you.

You want to get all incidents where:

  • The state is not "Closed"
  • Assigned to your user ID

GlideRecord Script:

var gr = new GlideRecord('incident'); // Targeting the 'incident' table
gr.addQuery('state', '!=', '7'); // State not equal to 'Closed' (state 7 = Closed)
gr.addQuery('assigned_to', gs.getUserID()); // Assigned to current user
gr.query(); // Run the query

while (gr.next()) {
gs.info('Incident Number: ' + gr.number); // Print incident number
}

 

Imagine you're an Infra Dev Specialist and want to automate a script that checks for stale incidents (e.g., not updated in 7 days). GlideRecord helps you fetch those records and take action—like sending reminders or escalating.

 

Help future readers out—mark the answer and close the thread if it helped you! ðŸ˜Š


If this response resolved your issue, kindly mark it as Helpful or Accept Solution—it helps others find the answer faster.

Shraddha Kadam
Mega Sage

 

Hello @redijanirud ,

 

In ServiceNow, GlideRecord is a fundamental and incredibly powerful JavaScript class that provides the primary way to interact with the ServiceNow database from server-side scripts.

 

GlideRecord is a built-in class in ServiceNow's server-side scripting environment.

 

Why we used -

In ServiceNow, GlideRecord is a fundamental and incredibly powerful JavaScript class that provides the primary way to interact with the ServiceNow database from server-side scripts. Think of it as ServiceNow's equivalent to SQL queries, but within a JavaScript context.

 

What it is:

A JavaScript Class: GlideRecord is a built-in class in ServiceNow's server-side scripting environment.

Database Interaction: Its core purpose is to enable scripts to perform CRUD (Create, Read, Update, Delete) operations on records stored in any table within the ServiceNow database.

Why it's used:

Querying Data (Read): This is perhaps its most common use. You can define conditions (like addQuery(), addEncodedQuery()) to filter records and then iterate through the results using query() and next().

Inserting New Records (Create): You can create a new GlideRecord object, set its field values, and then use insert() to add a new record to the table.

Updating Existing Records (Update): You can query for existing records, modify their field values, and then use update() to save the changes to the database. You can update single records or multiple records with updateMultiple().

Deleting Records (Delete): You can query for records and then use delete() or deleteMultiple() to remove them from the table.

Server-Side Scripting: GlideRecord is predominantly used in server-side scripts such as:

  • Business Rules: To automate actions based on record events (e.g., when an incident is created, update a related record).
  • Script Includes: To create reusable server-side functions that can be called from various scripts.
  • UI Actions (Server-side): To perform database operations when a user clicks a button.
  • Scheduled Jobs: For batch processing and data manipulation at specific times.
  • Workflows and Flow Designer: To interact with records within automated processes.

You can refer the below links -

https://www.servicenow.com/docs/bundle/washingtondc-api-reference/page/app-store/dev_portal/API_refe...

https://www.servicenow.com/docs/bundle/washingtondc-api-reference/page/app-store/dev_portal/API_refe...

 

If my response was helpful, please mark it as correct and helpful.
Thank you.