
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 10:20 AM
HI .... as I'm using a scoped application I assume this might be the reason why the xx.addOrCondition gives me an error in the logs ... ;-(
" Cannot find function addOrCondition in object [object GlideRecord]."
Could you please help me doing what is done here ... just without requiring the xx.addOrCondition ?
....
var xx = new GlideRecord("sn_customerservice_channel_config");
var arrXX = email.to.split(',');
var k = 0;
for (var n = 0; n < arrXX.length; n++) {
if (k == 0) {
xx.addQuery('email_address', arrXX[n]);
k++;
} else {
xx.addOrCondition('email_address', arrXX[n]);
}
}
xx.query();
....
Thank you!!!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 11:22 AM
Can we try in this way. see if this helps.
var k = 0;
var queryString;
var arrXX = email.to.split(',');
var xx = new GlideRecord("sn_customerservice_channel_config");
for (var n = 0; n < arrXX.length; n++) {
if (k == 0) {
queryString = 'email_address=' + arrXX[n];
k++;
} else {
queryString = queryString + '^ORemail_address=' + arrXX[n];
}
}
xx.addEncodedQuery(queryString);
xx.query();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 11:54 AM
Can you please put gs.info(queryString); just before the xx.query(); and see if it's forming the query will all the required email ids?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 12:06 PM
There was a } mismatch - my mistake ;-/
Thank you SOOOOOO mutch all .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 12:09 PM
no worries just so you have it .. this is a REALLY good write up on glidequery...
https://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
while it wouldn't have helped in this case.. it is a great bookmark to keep.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 11:14 AM
This is interesting. addOrCondition should not have anything to do with scoped or otherwise, but maybe I don't know. I would log a ticket with ServiceNow to solve it the right way.
If there is not going to be too many email addresses:
var xx = new GlideRecord("sn_customerservice_channel_config");
var arrXX = email.to.split(',');
for (var n = 0; n < arrXX.length; n++) {
xx.initialize();
xx.addQuery('email_address', arrXX[n]);
xx.query();
}
But that will make multiple query calls to the DB.
You are not going this through a client script, right? Can you explain the full use case.
Manish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 11:21 AM
... gs.log will also not work in scoped apps ... while gs.info works.
Don't ask me why - but is like it is ;-(
I have different mails that can sent to the system and I need to check the table to verify that at least one of the mails used does match the table entries to get the refereed assignment group ...
I will try your code ... and post again.
Thanks in advance