enter image description here

I want to get the Users which report to a particular user (A manager) by using the Hierarchical Relationship inside the User Object. Appreciate if someone can give an example.

Small clarification:

How can I get the users from the Manager's point of view (What I need to do here is identify the users who are managers by looking at the availability of his/her child users via the Hierarchical Relationship (in my case field name is Planner__c) ). I have used the query like this. but it not working.

SELECT Name (SELECT Id,Name FROM Planner__r) FROM User
| improve this question | | | | |

A simple SOQL will work here.

SELECT UserName, Id, Manager.Name, Manager.Id, Manager.Profile.Name FROM User

if it's a new custom field you can refer the same.

| improve this answer | | | | |

From the Manager's perspective I have managed to generate the query. Problem was I could't find the child relationship name. Thanks for all our answers.

SELECT Name, (SELECT Id,Name FROM Users1__r) FROM User
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.