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

@jobin1 

 

Below query translates into what you have stated in text

var query = "number="+number+"^stateIN3,4,7,110"+"^ORnumberNOT LIKE"+number;

 

I Hope this helps.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

Hello,

 

Please use the below:-

 

 

addEncodedQuery('numberLIKE'+number+'^stateIN3,4,7,110^NQnumberNOT LIKE'+number);

 

 

Please mark my answer as correct based on Impact.

Hi

Showing the below error.

jobin1_0-1666938937382.png

 

There is a + missing use below:-

 

addEncodedQuery('numberLIKE'+number+'^stateIN3,4,7,110^NQnumberNOT LIKE'+number);

 

Please mark my answer as correct based on Impact.

 

Not sure why when I pass any open /WIP/pend ticket that time also comes in this loop that's the problem.

Are they any other way to add an OR condition at last something like below?

//sc_item1.addOrCondition('numberNOT LIKE'+number);