I am running the following query:
SELECT Name, ManagerID FROM User
The result yields a User's name and their corresponding Manager's user ID.
How can I return the Manager's name instead of the ID in SOQL?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
A great way to learn SOQL is to use the Schema Browser in the Force.com Eclipse IDE. In the screen shots below, I browsed to the User object:
Then scrolled down to the ManagerId field (note it is of type reference), then clicked on Type Data > Reference To > User > Fullname
And, SFDC has automatically built the SOQL for you in the Query pane:
Note: The 'u' can be omitted from your SOQL