What is GlideRecord in ServiceNow?
GlideRecord is ServiceNow’s main server-side JavaScript API for working with records. You use it in scripts to query, create, update and delete data in any table.
A basic query
A typical query looks like this: create var gr = new GlideRecord('incident');, add filters with gr.addQuery('active', true); and gr.addQuery('priority', 1);, run gr.query();, then loop with while (gr.next()) { … }. Inside the loop, gr.number or gr.getValue('number') reads a field.
Creating and updating records
To create a record, call gr.initialize(), set fields, then gr.insert(), which returns the new sys_id. To update, query the record, change fields and call gr.update(). gr.deleteRecord() removes a single record, and deleteMultiple() removes every record matching the query.
Useful shortcuts
gr.get(sys_id) loads one record directly. addEncodedQuery() accepts a query string copied from any list filter, which is often the quickest way to build complex conditions. setLimit() restricts how many records are returned, and orderBy() sorts results.
Performance tips
Always filter queries; an unfiltered query on a large table can slow down the whole instance. Use setLimit(1) when you only need to know whether a record exists. To count records, use GlideAggregate instead of looping or calling getRowCount(). Use getValue() when you need a plain string, to avoid accidentally passing a reference object around.
Security note
GlideRecord ignores ACLs. If a script runs on behalf of a user and should respect their permissions, use GlideRecordSecure instead.
Frequently asked questions
Can I use GlideRecord in a client script?
Technically yes, but it is strongly discouraged. Use GlideAjax with a script include so the query runs on the server.
What is the difference between GlideRecord and GlideAggregate?
GlideRecord returns records. GlideAggregate calculates counts, sums and averages efficiently on the database.
Why does my update trigger business rules?
Because update() saves the record normally. setWorkflow(false) skips business rules, but use it carefully since it also skips audit and notifications.
Related ServiceNow terms

Need help with GlideRecord or anything else in ServiceNow? We’re here with practical solutions that fit your organization and your teams.
Browse all 100 ServiceNow terms
ServiceNow is a trademark of ServiceNow, Inc. This glossary is an independent resource by Sequal Consultancy and is not affiliated with or endorsed by ServiceNow, Inc.