How can you get manager of manage of logged-in user as default value?

Koji Yanase
Tera Contributor

I can get the manager by "javascript:gs.getUser().getRecord().getDisplayValue('manager')". Then, I tryed "javascript:gs.getUser().getRecord().getValue('manager').getRecord().getDisplayValue('manager')" to get manager of the manager. But it doesn't work. How can I get manager of the manager?

Thanks.

1 ACCEPTED SOLUTION

Anthony_vickery
Tera Expert

The biggest issue I've encountered with the gs.getUser() object, is that the values obtainable within are not necessarily up to date. The values were current when the user's session was created, but if they change during the session, they are no longer all that useful. In that case, you would want to use a glide record such as the one Kalai has used above with some checking to avoid a potential missing manager or 2. Otherwise, the correct syntax is:


gs.getUser().getUserByID(gs.getUser().getManagerID()).getManagerID();




//breaking it down further...


//get a user object for the current user


gs.getUser()



//change the user object from the current user to their manager


gs.getUser().getUserByID(gs.getUser().getManagerID())



//get the manager id of that user object (i.e. user's manager's manager)


gs.getUser().getUserByID(gs.getUser().getManagerID()).getManagerID();


View solution in original post

12 REPLIES 12

Thank you for your tip!


Anthony_vickery
Tera Expert

The biggest issue I've encountered with the gs.getUser() object, is that the values obtainable within are not necessarily up to date. The values were current when the user's session was created, but if they change during the session, they are no longer all that useful. In that case, you would want to use a glide record such as the one Kalai has used above with some checking to avoid a potential missing manager or 2. Otherwise, the correct syntax is:


gs.getUser().getUserByID(gs.getUser().getManagerID()).getManagerID();




//breaking it down further...


//get a user object for the current user


gs.getUser()



//change the user object from the current user to their manager


gs.getUser().getUserByID(gs.getUser().getManagerID())



//get the manager id of that user object (i.e. user's manager's manager)


gs.getUser().getUserByID(gs.getUser().getManagerID()).getManagerID();


Bingo! That is what I want to achieve in one line.


Thank you!


 after using this

gs.getUser().getUserByID(gs.getUser().getManagerID())

solution 

the output is like com.glide.sys.User@cb0590

not the managerId 

so how to get ManagerID or Name ??

please explain 

I tried to get manager's manager full name in Vancouver:

gs.getUser().getUserByID(gs.getUser().getUserByID(gs.getUser().getRecord().getValue('manager')).getManagerID()).getFullName()