
- 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 10:51 AM
I believe you can do with addEncodedQuery() query as well.http://wiki.servicenow.com/index.php?title=GlideRecord#addEncodedQuery
http://wiki.servicenow.com/index.php?title=GlideRecord#addEncodedQuery

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 11:01 AM
Hi Shishir,
not sure if this could work - at least I see not how.
I have 2 arrays with emails and need to check if arrXX is in "email_address" of table "sn_customerservice_channel_config" ...
...

- 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:42 AM
This one has worked!!!
THank you!!!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 11:45 AM
shit ... no it didn't.
Did not check all ... rowcount does not tell the right number