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

Notifications

Announcements

No record found.

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)
  • André Arnaud de Calavon Profile Picture
    301,069 Super User 2025 Season 2 on at

    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?

  • OsamaAG Profile Picture
    65 on at

    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.

  • OsamaAG Profile Picture
    65 on at

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

  • Verified answer
    Martin Dráb Profile Picture
    237,959 Most Valuable Professional on at

    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

    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.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans