GlideQuery Debug functions
Notes about some debug functions availible for GQ.
GlideQuery in ServiceNow is just great! 👍
Some useful debug functions from the GQ Script Include. (GQ is a utility class intended for use with GlideQuery.)
GQ.debug
GQ.debug(value)
Will result in a gs.debug(value)
.
GQ.jsonDebug
GQ.jsonDebug(value)
JSON Stringify pretty-print, as follows: JSON.stringify(value, null, 2));
GQ.labelDebug
GQ.labelDebug("value", {one: 1, two: 2, three: 3})
Similar to the GQ.jsonDebug but with the addition of a label.
More common example would be similar to the one described in the Script Include -->
new GlideQuery('sys_user')
.select('first_name', 'last_name')
.map(GQ.labelDebug('User Info'))
.toArray(20);
Summary
The Script Include has examples for each of the different functions included, worth looking into, available here: https:// < instance name > service-now.com/nav_to.do?uri=sys_script_include.do?sys_id=2f331e7d73912300bb513198caf6a711