ServiceNow uses a special type of super flexible variable to store information in what appears like a single field, but is actually a complex storage/management system with a database column type called glide_var.
As each record can have a different number of variables stored as key/value pairs, there’s no easy way of dot-walking to the name of the variable within the glide_var as the names can change from record to record within the same table! You can, however, detect and retrieve variables from a glide_var by treating the gliderecord field as an object.
In this example, from an automated test framework step, you can see each of the variables and their values from the database glide_var column inputs.
var gr = new GlideRecord('the table you are looking at')
gr.get('sys_id of the record you are looking at')
for(var eachVariable in gr.inputs){
gs.info(eachVariable + ' : ' + gr.inputs[eachVariable])
}
If you run this in a background script you’ll see precisely which variables exist and what their values are.

Our team on the case
Our ServiceNow stories
How Contract Management Can Help Your Customers
Read More
Manipulating Service Portal Widgets Without Modifying Them
Read More
Virtual Agent Is Your Friend
Read More
Using Common Functions in the Service Catalog
Read More
ServiceNow Archiving
Read More
Browser Console
Read More
Glide Variables
Read More
Asset Management in ServiceNow
Read More
Understanding Database Indexes in ServiceNow
Read More
Fast-track ServiceNow upgrades with Automated Testing Framework (ATF)
Read More
Now Forum 2018
Read More
ServiceNow Catalog Client Scripts: G_Form Clear Values
Read More
How PagerDuty integrates with AppDynamics, Micro Focus, ServiceNow, and Splunk
Read More
Meet us at the ServiceNow Future of Work tour
Read More
Key risk management tools for IT managers in 2018
Read More
How to effectively manage your CMDB in ServiceNow
Read More
Breaking down silos to create an enterprise capability
Read More
ServiceNow and single sign-on
Read More
How to customise the ServiceNow Service Portal
Read More
Integrating a hand-signed signature to an Incident Form in ServiceNow
Read More
Integrating OMi (Operations Manager i) with ServiceNow
Read More
Case Study: ServiceNow Agile application development for Tabcorp
Read More
Introducing ServiceNow Jakarta
Read More
ServiceNow—The latest and greatest at Knowledge17
Read More
Service portal simplicity
Read More
What’s new in ServiceNow for 2017?
Read More
Filtered Reference Fields in ServiceNow
Read More
ServiceNow performance testing tips
Read More
ServiceNow Helsinki
Read More
Straight-Through Processing with ServiceNow
Read More
ServiceNow Choice List Dependencies
Read More






I ran above script, and it doesnt return anything .
var gr = new GlideRecord(‘incident’);
gr.get(‘965c9e5347c12200e0ef563dbb9a7156’);
gs.print(gr.sys_id);
for(var eachVariable in gr.inputs){
gs.info(eachVariable + ‘ : ‘ + gr.inputs[eachVariable]);
}
Output
*******
[0:00:00.202] Script completed in scope global: script
Script execution history and recovery available here
*** Script: 965c9e5347c12200e0ef563dbb9a7156