web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Get the Highest hierarchy level user.

(0) ShareShare
ReportReport
Posted on by 65

Hi All,

Lets say I have three user in the list for which I have IDs and I want to find the which user comes first in the hierarchy. 

Lets say User A is the Manager, User B is Senior and User C is Junior. So, in this case I will get User A as an answer because it is the top in the hierarchy. ( The Hierarchy that I am talking about is     Human Resource -> Position -> Position Hierarchy. )

Does anyone know how to achieve it?


Thanks.

I have the same question (0)
  • OsamaAG Profile Picture
    65 on at
    RE: Get the Highest hierarchy level user.

    goshoom Thanks Martin for the reply.

    Yes, your answer helped. One more thing I have to ask is that is there any way I can get UserID ( found in SysUserInfo) from HCMPosition.

    I know we can get Worker from HCMPosition::getWorker. but I specifically want UserID in my case.

  • Verified answer
    Martin Dráb Profile Picture
    236,172 Most Valuable Professional on at
    RE: Get the Highest hierarchy level user.

    Use HcmPositionHierarchy table. Find it by Position and PositionHierarchyType and look at ParentPosition. Then repeat the same process for the parent position, and do it until you find HcmPositionHierarchy without ParentPosition.

  • OsamaAG Profile Picture
    65 on at
    RE: Get the Highest hierarchy level user.

    goshoom  If you could also help me out on this one.

  • OsamaAG Profile Picture
    65 on at
    RE: Get the Highest hierarchy level user.

    Thanks for the reply Andre.

    It was just an example. Yes there could be more or less and Yes there can be other positions like CEO you mentioned.

    I just want the user ( Out of any number of users provided )  that is highest in the hierarchy.

  • André Arnaud de Calavon Profile Picture
    298,647 Super User 2025 Season 2 on at
    RE: Get the Highest hierarchy level user.

    Hi Osama,

    Can you elaborate? Do you always have 3 users or sometimes more or less? What should happen in case there is also e.g. a CEO above the manager? Can you provide some more information for us to be fully able to understand your scenario and requirement?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,352

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 830 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 634 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans