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.
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.
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.
goshoom If you could also help me out on this one.
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.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,352
André Arnaud de Cal... 830 Super User 2025 Season 2
Sohaib Cheema 634 User Group Leader