
- 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:26 AM
Hello,
Are you trying in client script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 10:32 AM
Try the below. But why are you querying the same thing in both conditions?
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) {
var qc = xx.addQuery('email_address', arrXX[n]);
k++;
} else {
qc.addOrCondition('email_address', arrXX[n]);
}
}
xx.query();
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 10:32 AM
Try this:
var xx = new GlideRecord("sn_customerservice_channel_config");
var arrXX = email.to.split(',');
var k = 0;
var query;
for (var n = 0; n < arrXX.length; n++) {
if (k == 0) {
query = xx.addQuery('email_address', arrXX[n]);
k++;
} else {
query.addOrCondition('email_address', arrXX[n]);
}
}
xx.query();
OR EVEN SIMPLER
var xx = new GlideRecord("sn_customerservice_channel_config");
var arrXX = email.to.split(',');
var query = xx.addQuery('email_address', arrXX[n]);
for (var n = 0; n < arrXX.length; n++) {
query.addOrCondition('email_address', arrXX[n]);
}
xx.query();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 10:49 AM
Thank you guys!
To answer the why question ... cause the even simpler one is not so simple for everyone ... 😉
I'm a low code person ... ;-(
Anyhow .. I tried and the result is the same - not working as it will not work in a scoped application
log:
com.glide.script.fencing.ScopedQueryCondition.jsFunction_addOrCondition(ScopedQueryCondition.java:44)
sun.reflect.GeneratedMethodAccessor1175.invoke(Unknown Source)
How to do without the query.addOrCondition ???