Performance issue on Advanced reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2025 05:46 AM
We have written one script include in global scope and calling it in Reference qualifier of Human resource:core scope.
We have one field referencing to user table in which we have reference qualifier to advanced from that we are calling script include. when we search its taking almost 3 to 4 minutes to get the users into the reference field.
Currently we have 60k records in the HR profile table.
below is my code:
getUsers: function() {
var arr = [];
var grManager = new GlideAggregate("sn_hr_core_profile");
grManager.addEncodedQuery('u_employment_statusNOT LIKETerminated');
grManager.query();
while (grManager.next()) {
arr.push(grManager.user.toString());
}
return 'sys_idIN' + arr;
},
reference:
javascript: new scriptIncludeName().getUsers()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2025 05:49 AM
Please use GlideRecord in your script include in place of GlideAggregate and try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2025 05:56 AM
Hi @Swapna Abburi ,
We tried this but still facing the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2025 06:14 AM
please use GlideRecord.
With 60k records it should not take much time.
getUsers: function() {
var arr = [];
var grManager = new GlideRecord("sn_hr_core_profile");
grManager.addEncodedQuery('u_employment_statusNOT LIKETerminated');
grManager.query();
while (grManager.next()) {
arr.push(grManager.user.toString());
}
return 'sys_idIN' + arr;
},
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
‎03-05-2025 06:36 AM
Hi @Ankur Bawiskar ,
Thanks for the code, but unfortunately, it didn't worked it is taking 3 to 4 minutes to load when I'm using GlideRecord.