How to query doesn't contain in glide record.

jobin1
Tera Expert

Hi All,

 

How to Query does not contain in glide record. Tried below but not working.

 

Need to query "if a particular RITM no is not available in sc_req_item"

if (emailsubject.includes("RITM")) {
subject = emailsubject;
indexStart = subject.indexOf('RITM');
number = subject.slice(indexStart, indexStart + 12);
gs.log("custmint191" + number);

var sc_item1 = new GlideRecord("sc_req_item");

//sc_item1.addEncodedQuery('number NOT LIKE number');
//sc_item1.addEncodedQuery('number DOES NOT CONTAIN number');
//sc_item1.addEncodedQuery('numberNOT LIKE' + number);

sc_item1.query();

 

22 REPLIES 22

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Please use it as below assuming you are storing the number correctly in the number variable:-

 

sc_item1.addEncodedQuery('numberNOT LIKE'+number);

 

OR

 

try as below:-

 

  gm.addQuery('number','DOES NOT CONTAIN',number);

 

Please mark my answer as correct based on Impact

I need to add it in a or condition tried it below query  but not working 

 

sc_item1.addEncodedQuery('number, number ^stateIN3,4,7,110^ORnumber NOT LIKE number');

sc_item1.addEncodedQuery('number, number ^stateIN3,4,7,110^ORnumber DOES NOT CONTAIN number');

Hello,

 

Can you write in text what the query should be and then I can help with the query itself

glide RITM table and look for records that either  contains number which have extracted from the email and state should be one of 3,4,7,110 or which do not contains  number 

These 3 conditions need to consider  while querying