Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Check case sensitive in addQuery filter condition

sana11
Kilo Guru

Hi All,

I have a reference field in my catalog form, on choosing of values fetching data from another table. Here I have duplicate names for some records but case sensitive is different. So I just want to get result data only to the name which I passed.

For example.

var gr= new GlideRecord('location');

gr.addQuery('country','INdia'); //should return exact results of INdia not india,INDIA and whatever is available in table.

gr.Query();

 

Can anyone suggest some ideas ?

Thanks!

 

 

 

 

14 REPLIES 14

Hi Sana,

already shared the updated code; please check the same

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Sana,

Any update on this?
Can you mark my answer as correct, 👍 helpful if you were able to achieve the requirement. This enables other members to learn from this thread.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Sana,

you can use this approach; but that would cause performance issue since it will query entire table and check 1 by 1 each record

It would search for the exact string

var rec = new GlideRecord('location');
rec.query();
 
while(rec.next())
{
   if(GlideFilter.checkRecord(rec, "country=INdia")){
   gs.info('Found the exact record for INdia');
   }
}

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you @Ankur Bawiskar . This helped me!

@Nishita Padwal 

Glad to know that it helped.

Please mark response helpful as well.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader