Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

addOrCondition not working ...

Zod
Giga Guru

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!!!

1 ACCEPTED SOLUTION

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();


View solution in original post

22 REPLIES 22

randrews
Tera Guru

I am going to assume this is a client script... per


Client Scripts - ServiceNow Wiki


add or condition is not available on the client side.


OBTW... the workaround is to create an encoded query and add that.


part on an inbound action script