- 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:19 PM
Hi,
So what is required?
The script will return only those users which are managers. Is that not required?
Are you saying when user does the lookup you need to show additional field (manager) along with Name, First Name, Last Name, Email?
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-29-2021 12:01 AM
Need to get only managers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2021 12:22 AM
Hi,
then the advanced ref qualifier I gave should give you only those users who are manager of somebody
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-29-2021 12:28 AM
Hi,
It shows only managers but it show duplcates also, that means it show double times if the manager has two users.
- 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