GlideSystem (gs) API
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)
Want to learn this properly?
Our live, instructor-led ServiceNow Training covers this hands-on, with real projects and a certification path.
Check your understanding
Which logs to the system log?
- A. gs.info()
- B. g_form.setValue()
- C. gr.query()
Show answer
A. gs.info()
gs.info writes to the log.
How do you get the current user name server-side?
- A. gs.getUserName()
- B. current.name
- C. g_user
Show answer
A. gs.getUserName()
gs.getUserName() returns the logged-in user.
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.