How can you get manager name based on logged-in user?

Raji9
Tera Expert

In the scoped application,  I am not able to use 'javascript:gs.getUser().getManagerID()' for to set   default value of the current manager.  it is not supported in the scoped application.  Is there any easiest way  to set the default value?

 

Thanks

8 REPLIES 8

Maik Skoddow
Tera Patron

Hi @Raji 

dot-walking is always possible.

var user = gs.getUser();
var manager = user.manager;

Kind regards
Maik

If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.

Susan Britt
Mega Sage

Are you trying to set this default value on a record producer variable?  If so, you will need to create a Script Include and Catalog Client Script to populate.

Ankur Bawiskar
Tera Patron

Hi,

that's correct.

Another way is use script in the default value and it would work

javascript: var manager; var user = new GlideRecord('sys_user'); user.get(gs.getUserID()); manager = user.manager; manager;

Regards
Ankur

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

@Raji 

Hope you are doing good.

Did my reply answer your question?

If so, please mark my response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.

Thanks!
Ankur

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