How can i get list of all Group managers who have only inactive users under them?

Ankit Kumar6
Tera Contributor
 
1 ACCEPTED SOLUTION

Hi @Ankit Kumar6,

 

Oh! got it your exact need. try this scripts.

 

 

var managerRecords = new GlideRecord("sys_user_grmember");
managerRecords.addQuery("user.active=false^user.managerISNOTEMPTY");
managerRecords.query();
while (managerRecords.next()) {
	gs.info(managerRecords.user.manager.name.toString());
}

 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

View solution in original post

9 REPLIES 9

Sagar Pagar
Tera Patron

Hi @Ankit Kumar6,

 

You can go to User [sys_user] table and apply the filter as

Active IS false

&&

Manager ISNOTEMPTY

&&

Manager.active IS true

 

and export it to excel as per need.

 

OR

Add same filter in addEncodedQuery() in GlideRecord using background scripts.

 

active=false^managerISNOTEMPTY^manager.active=true

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

Hi Sagar,

 

My question is different, i want to get all group manager name who have only inactive user under them. 

Hi @Ankit Kumar6,

 

Oh! got it your exact need. try this scripts.

 

 

var managerRecords = new GlideRecord("sys_user_grmember");
managerRecords.addQuery("user.active=false^user.managerISNOTEMPTY");
managerRecords.query();
while (managerRecords.next()) {
	gs.info(managerRecords.user.manager.name.toString());
}

 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

anshul_goyal
Kilo Sage

Hi @Ankit Kumar6,

Do you need a Group Manager Name or an Inactive User Manager Name?

Thanks,
Anshul