- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2023 05:37 PM - edited 09-11-2023 05:38 PM
Running the below codes results in an error that reads: "TypeError: Cannot find function parse in object GlideQuery<undefined> []."
var table = 'incident'
var equery = "";
var gq = new global.GlideQuery()
.parse(table,equery)
.select('number')
.forEach(
function(u){
gs.info(u.number)
});
I have tried a number of variations like this:
var table = 'incident'
var equery = "";
var gq = new global.GlideQuery(table)
.parse('incident',"")
.select('number')
.forEach(
function(u){
gs.info(u.number)
});
None of which work in a scoped application from do work if I am globally scoped. It appears as if the parse function is not included in the Server Scoped variant of GlideQuery even though the documentation specifically says that it is. Any help would be much appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 10:32 PM - edited 10-04-2023 10:48 PM
Assuming you have a cross scope privilege to call GlideQuery, this is the correct syntax.
var table = "incident";
var equery = "numberENDSWITH111";
global.GlideQuery.parse(table, equery)
.select("number")
.forEach(function (inc) {
gs.info(inc.number);
});
parse() is a static class method not a class instance method.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2023 06:52 PM
I think issue is with Empty Query String, Can pass something like below and try?
var table = 'incident';
var equery = 'state=2'; // Use the appropriate condition for 'Active' state
var gq = new global.GlideQuery()
.parse(table, equery)
.select('number')
.forEach(function(u) {
gs.info(u.number);
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2023 06:56 PM - edited 09-11-2023 06:56 PM
Running the code you posted results in the same error "Cannot find function parse in object GlideQuery...".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 10:32 PM - edited 10-04-2023 10:48 PM
Assuming you have a cross scope privilege to call GlideQuery, this is the correct syntax.
var table = "incident";
var equery = "numberENDSWITH111";
global.GlideQuery.parse(table, equery)
.select("number")
.forEach(function (inc) {
gs.info(inc.number);
});
parse() is a static class method not a class instance method.