Check case sensitive in addQuery filter condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 04:14 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 06:46 AM
Hi Sana,
already shared the updated code; please check the same
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2020 09:41 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 04:55 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 11:41 AM
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 07:25 AM
Glad to know that it helped.
Please mark response helpful as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader