ServiceNow GlideRecord Complete Reference
by NowSpectrum
$29+
If you write ServiceNow scripts, you use GlideRecord every single day. But most developers learn it piecemeal — copying patterns from Stack Overflow, guessing at method signatures, and discovering the hard way that a query inside a loop is a production incident waiting to happen.
This reference fixes that.
What's inside — 24 pages:
The GlideRecord Complete Reference covers the full API from the ground up, written by working Platform Architects who have seen these patterns succeed and fail in enterprise deployments managing $20M+ ACV instances.
Fundamentals — Instantiation, query(), next(), get(). The exact difference between them, when each is appropriate, and the silent bugs that happen when they're used wrong.
Query Methods — addQuery(), addOrCondition(), addEncodedQuery(). The full operator reference table. How AND/OR conditions are grouped. How to build encoded queries dynamically.
Reading Field Values — getValue() vs getDisplayValue(), dot-walking reference fields without firing extra queries, and why comparing against gr.field instead of gr.getValue('field') causes silent comparison failures.
Writing Field Values — The setValue() vs setDisplayValue() distinction that every developer gets wrong at least once. How passing a display label to setValue() corrupts your data silently, with no error thrown.
Performance Patterns — The N+1 query anti-pattern and how to eliminate it with dot-walking. setLimit() for single-record lookups. setWorkflow(false) for bulk operations. chooseWindow() for server-side pagination on large data sets. Every pattern that keeps your instance healthy under load.
GlideAggregate — COUNT, SUM, AVG, GROUP BY patterns. Why you should never use GlideRecord to count records. The faster alternative for existence checks.
Encoded Query Reference — Every operator with syntax examples. OR conditions, relative date filters, NULL checks, dynamic query building, and the javascript: prefix for embedding GlideSystem calls.
Anti-Patterns — A 10-row table of the most common GlideRecord mistakes: what each one does, why it fails silently, and the correct replacement.
Quick Reference Tables — All 27 GlideRecord methods at a glance. Standard Incident state values. Priority, Urgency, and Impact stored values. Everything you need to stop guessing.
Who this is for:
ServiceNow developers who want a single authoritative reference rather than scattered documentation
Admins moving into scripting who need to learn correct patterns from the start
Architects reviewing code who need a checklist of what to look for
Anyone who has ever shipped a script that worked in dev and failed in prod
What makes this different:
This is not a documentation summary. Every pattern in this reference is something we have seen cause production incidents at scale. The performance section alone — N+1 queries, missing setLimit(), unbounded chooseWindow() — covers the most common sources of platform degradation we encounter in enterprise audits. The anti-patterns table exists because we have seen all ten of them in production code at Fortune 500 companies.
The opinion blocks tell you what we actually think, not what the documentation says. The war stories are real.