IT CanvassTalk to an advisor
ServiceNow References · LessonBy , ServiceNow Architect · Published · current release · reference

GlideRecord API

The essential server-side query methods.

Quick answer

GlideRecord is the server-side database API.

Key takeaways
  • Query
  • Read & write

GlideRecord is the server-side database API.

Query

  • addQuery(field, value), add a condition.
  • addActiveQuery(), active = true.
  • addEncodedQuery(str), a full encoded query.
  • orderBy(field) / setLimit(n)
  • query() then next()

Read & write

  • getValue(field) / setValue(field, val)
  • insert() / update() / deleteRecord()
  • get(sys_id), fetch one record.
  • getRowCount()
Try it YourselfJavaScript
▸ Press Run to execute.

Runs in a sandbox in your browser. Mock gs and GlideRecord and sample data are provided.

Quick check

+0 XPStreak ×0
Question 1 of 2
Which method adds a full encoded query string?

Frequently asked questions

What does the term GlideRecord API refer to in ServiceNow?
GlideRecord is the server-side database API.
Practise this on your own free instance.
Set up your free instance →
Already working on ServiceNow and stuck on a live ticket?Get an expert ServiceNow developer on screen-share to finish your daily tasks with you. Deliver on time, protect your reputation and your job. Monthly support only, no task-wise plans.Task assigned · no idea where to startStill stuck · your job on the lineExpert joins your screenDelivered on timeExplore On Job Support