- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 05:49 AM
Hi All,
We have the following reference qualifier condition in the reference type variable:
nameSTARTSWITHCORE
It dislays results in both upper and lower case letters.
Is there a way to filter the results to show only the ones that start with CORE in the upper case letters?
Thank you in advance for any hints.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 05:57 AM
STARTSWITH in ServiceNow is case insensitive so it will show lower and upper case both.
you will have to use script for this
Script Include:
var RefUtils = Class.create();
RefUtils.prototype = {
initialize: function() {},
getRecords: function() {
var answer = '';
var gr = new GlideRecord('YOUR_TABLE');
gr.addQuery('name', 'STARTSWITH', 'CORE');
gr.query();
var ids = [];
while (gr.next()) {
// Ensure exact case match at runtime
if (gr.name.toString().startsWith('CORE')) {
ids.push(gr.sys_id.toString());
}
}
if (ids.length > 0) {
answer = 'sys_idIN' + ids.join(',');
} else {
answer = 'sys_idIN';
}
return answer;
},
type: 'RefUtils'
};
Then call it like this
javascript: new RefUtils().getRecords();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 05:56 AM
Hi @kandulek ,
Reference qualifier condition is case insensitive by default.
You can create a script include based if the number of records returned is not huge. This script include can checks the case and return the sys_id as coma separated value.
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 05:57 AM
STARTSWITH in ServiceNow is case insensitive so it will show lower and upper case both.
you will have to use script for this
Script Include:
var RefUtils = Class.create();
RefUtils.prototype = {
initialize: function() {},
getRecords: function() {
var answer = '';
var gr = new GlideRecord('YOUR_TABLE');
gr.addQuery('name', 'STARTSWITH', 'CORE');
gr.query();
var ids = [];
while (gr.next()) {
// Ensure exact case match at runtime
if (gr.name.toString().startsWith('CORE')) {
ids.push(gr.sys_id.toString());
}
}
if (ids.length > 0) {
answer = 'sys_idIN' + ids.join(',');
} else {
answer = 'sys_idIN';
}
return answer;
},
type: 'RefUtils'
};
Then call it like this
javascript: new RefUtils().getRecords();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 10:37 AM
Thank you both for your help!