GlideRecord
GlideRecord is the server-side ServiceNow API for querying, inserting, updating and deleting records, walking results row by row through query() and next().
Also searched as: GlideRecord query, server-side query API.
In practice
Use addQuery for conditions, addEncodedQuery for filters copied from a list, and setLimit when you only need a few rows. For counts and sums use GlideAggregate instead — it pushes the maths to the database rather than pulling rows into memory. Never nest a query inside a result loop.
Example
Fetch every active P1 incident for a group and update its work notes in one pass.
var gr = new GlideRecord('incident');
gr.addQuery('active', true);
gr.addQuery('priority', 1);
gr.query();
while (gr.next()) {
gr.work_notes = 'Escalation review';
gr.update();
}What interviewers check
Expect GlideRecord vs GlideAggregate, and whether you spot the N+1 query antipattern in sample code.
Practise this topic
Related Automation terms
- Business RuleA Business Rule is server-side script that runs when a record is queried, inserted, updated or deleted, timed as before, after, async or display.
- GlideAjaxGlideAjax is the client-side API for calling a Client Callable Script Include asynchronously, so a form can fetch server data without a page reload.
- Flow DesignerFlow Designer is ServiceNow's low-code automation builder where a trigger plus a sequence of reusable actions replaces the legacy Workflow Editor.