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?

  • is your ManagerID field is a custom field of the User object itself?
    – highfive
    Commented May 14, 2014 at 18:24

2 Answers 2


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:

enter image description here

Then scrolled down to the ManagerId field (note it is of type reference), then clicked on Type Data > Reference To > User > Fullname

enter image description here

And, SFDC has automatically built the SOQL for you in the Query pane:

enter image description here

Note: The 'u' can be omitted from your SOQL

  • Very handy! I guess that SF uses "references" rather than JOINs. I am more used to the SQL syntax and didn't know how such relationships would translate to SF without a JOIN.
    – toolshed
    Commented May 15, 2014 at 15:04
  • Apparently when you run this query the entire Manager user object is returned, not just the name. I would have thought that the dot syntax would remedy this, but it didn't. I tried to run the code in both the IDE and Developer console with the same difficulty. Is there any way to get around this?
    – toolshed
    Commented May 16, 2014 at 12:21

Did you try this:

SELECT Name, ManagerID, Manager.Name FROM User

Manager is lookup to User

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .