IT CanvassTalk to an advisor
ServiceNow References · LessonBy , ServiceNow Trainer, 9 yrs · Published · current release · reference

GlideSystem (gs) API

Logging, user context and utility helpers.

Quick answer

gs is the GlideSystem object, available in all server-side scripts.

Key takeaways
  • Logging
  • User & context

gs is the GlideSystem object, available in all server-side scripts.

Logging

  • gs.info(msg), gs.warn(msg), gs.error(msg)
  • gs.addInfoMessage(msg), show a UI message.

User & context

  • gs.getUserName(), gs.getUserID()
  • gs.hasRole(role)
  • gs.nowDateTime()
  • gs.getProperty(name)
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 logs to the system log?

Frequently asked questions

What does the term GlideSystem (gs) API refer to in ServiceNow?
gs is the GlideSystem object, available in all server-side scripts.
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