Clarification on GlideQuery limitations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 12:19 PM
Can someone please explain the "Limitations" section in the ServiceNow documentation for "GlideQuery - Scoped, Global (Vancouver)"?
I have copy/pasted the below excerpt from the docs. What confuses me are the statements that GlideQuery does not support "Reading encoded queries" and "GlideDate and GlideDateTime objects (which are read as JavaScript strings)".
Limitations
The GlideQuery API does not support:
- Reading or writing to tables that do not allow access from other scopes.
- Reading encoded queries.
- GlideDate or GlideDateTime objects, which are read as JavaScript strings.
- FX currency fields.
- Updating journal field types.
- Queries with ambiguous conditional logic.
I tried out the below Fix scripts within a Vancouver PDI with successful output. Has ServiceNow updated the GlideQuery API to support these but has simply not updated their documentation yet? Or is there something I'm missing?
Encoded query
// Encoded query script
var ai = GlideQuery.parse('incident','active=true^ORDERBYnumber')
.limit(4)
.select('short_description','number');
ai.forEach(function(inc) {
gs.info("GlideQuery parse: "+inc.number+" "+inc.short_description);
});
Output:
*** Script: GlideQuery parse: INC0000002 Network file shares access issue
*** Script: GlideQuery parse: INC0000003 Wireless access is down in my area
*** Script: GlideQuery parse: INC0000007 Need access to sales DB for the West
*** Script: GlideQuery parse: INC0000015 I can't launch my VPN client since the last software update
GlideDateTime
// DateTime string script
var gq = new global.GlideQuery('incident')
.where("sys_created_on", ">=", "2021-01-01 12:00:00")
.count();
gs.info("GlideQuery count: "+gq);
Output:
*** Script: GlideQuery count: 48
I repeated the above within a scoped application using global.GlideQuery instead of GlideQuery and was also successful, though of course I did have to review the Application logs to see the results.
Thoughts?