function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to query the ManagerName in User Object?

Hi all,


How to get the manager name of the user. ?


userList1 = [ select id, name, firstname, lastname,ManagerId from user where Managerid =: Userinfo.getUserId() ];


Pls help.



Thanks in advance.



I think you want to get the manager name of user.If I am write then .

Id MAnagerID= [ select id,ManagerId from user where id=: Userinfo.getUserId() ][0].Managerid ;


string MAnagerNAme= [ select id,Name from user where id=: MAnagerID][0].Name;


Hope this will help you............


so your request says


return the user record fields for the user identified as the user where I am the manager. (user.getUserid())


I think u wanted


return the user info for the user who IS my manager

String username='someone else';

get users manager info

userList1 = [ select id, name, firstname, lastname from user where id= [select id from user where name =:username]];