Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

how to check user is a manager??

Kishore8
Kilo Guru

How to check user is a manager

6 REPLIES 6

sachin_namjoshi
Kilo Patron
Kilo Patron

You can use below methods in your code to check if current logged in user is manager.



Getting a User Object - ServiceNow Wiki



myUserObject.getManagerName() -- returns the user_name of the current user's manager


myUserObject.getManagerID() -- returns the sys_id of the current user's manager



Regards,


Sachin


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Ashish Nahar
Kilo Guru

If you want to highlight a user who is a manager, you can use the display settings.



http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#gsc.tab=0


Look for (3 Display Settings)

nthumma
Giga Guru

I don't think OOB there is any method to know if the user is a Manager,   you might write a script include using below code.



var user = gs.getUserID() //current user sys_id


var target = new GlideRecord('sys_user');


target.addNotNullQuery('manager');


target.addQuery('manager',user);


target.query();     // Issue the query to the database to get all records


  if(target.next()) {  


        retrun true;


  }


else


{


return false;


}