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
ckempckemp 

Need to find all direct reports for a user

I need to get all of the users who report to a certain manager.  If I go to Setup > My Personal Information > Personal Information, I can view and select a manager for my user.  However, this is not captured as a field in the User object and there does not appear to be a way to access this via SOQL that I can see.  The query "SELECT ManagerId FROM User" from this thread does not work either (the ManagerId column does not exist.) 

Any experts have idea how I can get at this value with SOQL?
A_SmithA_Smith
Hi CK,

Just read this again - ignore my previous response.  You might confirm you are using the latest version of the API.  Older versions of the API would not include this field.  Also, make sure the user you are using has access to the field (probably a system admin).

Thanks,

Andrew Smith
Force.com Product Manager



Message Edited by A_Smith on 06-25-2008 08:36 AM
Nazeer AhamedNazeer Ahamed
I believe you can set the manager for yourself in the link where you specified.  Admin can set the manager for all users in Manage users - users.

And the managerId field is available when you export user details by data loader. once you got the details in excel, you can do what you want.

ckempckemp
A_Smith,

You are absolutely right!  The tool I was using, SoqlExplorer 0.84 (an old version), wouldn't let me query User.ManagerId because it is using an old API (v. 9ish)  Using a query with API v. 13 yields exactly what I was looking for. Thanks a bunch!!