- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2021 09:58 PM
Hello Developers!
I am trying to get only managers in reference field on incident table.
I have tried with manager is not empty condition in reference qualifier, it shows users those have managers.
But I need to get only managers in field.
Please anyone suggest me.
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2021 12:33 AM
Hi,
update as this to show only the managers
var GetUsers = Class.create();
GetUsers.prototype = {
initialize: function() {
},
getOnlyManagers: function(){
var arr = [];
var gr = new GlideRecord("sys_user");
gr.addQuery("manager", "!=", "");
gr.query();
while(gr.next()) {
arr.push(gr.getValue('sys_id'));
}
var arrayUtil = new ArrayUtil();
arr = arrayUtil.unique(arr);
return arr.toString();
},
type: 'GetUsers'
};
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
‎01-28-2021 10:08 PM
Hi,
you will have to use advanced reference qualifier for this
1) query entire sys_user table and get only the managers from manager field and return those users
Script Include:
var GetUsers = Class.create();
GetUsers.prototype = {
initialize: function() {
},
getOnlyManagers: function(){
var arr = [];
var gr = new GlideRecord("sys_user");
gr.addQuery("manager", "!=", "");
gr.query();
while(gr.next()) {
arr.push(gr.getValue('sys_id'));
}
return arr.toString();
},
type: 'GetUsers'
};
Advanced ref qualifier:
javascript: 'sys_idIN' + new GetUsers().getOnlyManagers();
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
‎02-03-2022 12:22 PM