- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2020 03:15 AM
Hi Community,
I need help in filtering the records , which does not starts with in addQuery() method. How can we achieve this?
Any help would be greatly appreciated.
Thanks,
Pihu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2020 03:52 AM
Hi,
Sample below
var arr = [];
var rec = new GlideRecord('incident');
rec.query();
while(rec.next()){
var startsWith = rec.caller_id.name.startsWith('AB'); // this will give false when doesn not starts with
if(startsWith.toString() == 'false'){
arr.push(rec.number.toString());
}
}
gs.info('Incidents where caller name does not start with AB'+ arr);
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
‎11-22-2020 06:30 AM
Hope you are doing good.
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
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
‎11-19-2020 03:31 AM
Hi,
Does not starts with is not available in Servicenow but there is a way to achieve this. Please refer
Hope that helps!
Regards,
Muhammad
Muhammad