+ Start a Discussion
NatrajNatraj 

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.

PkSharmaPkSharma

Hi,

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 ;

then

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

 

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

sdetweilsdetweil

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]];

 

Sam