Need to visible only managers in reference field on incident table.

Mallika1
Giga Contributor

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!

1 ACCEPTED SOLUTION

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

11 REPLIES 11

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Are you saying you want only those users in the lookup which are managers or some users?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi,

Need to get only users who are managers. I have used reference qualifier with the conditions like manager is not empty.

Here, is the screen shot

find_real_file.png

It show users those are have manager. But it need to get users who are managers.

Hi,

I have shared the script below.

Please check the same

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi,

Yes I have tried the same script but it show same like before.