public Name getParentPositionWorkerName(HcmPositionRecId _positionRecId) HcmWorker hcmWorker; HcmPositionWorkerAssignment workerAssignment; HcmPositionHierarchy hcmPositionHierarchy; utcdatetime now = DateTimeUtil::getSystemDateTime(); // 1. Find the parent position in the hierarchy // 2. Join to the assignment table to find who sits in that parent position // 3. Join to the worker table to get the name select firstonly * from hcmWorker join workerAssignment where workerAssignment.Worker == hcmWorker.RecId && workerAssignment.ValidFrom <= now && workerAssignment.ValidTo >= now join hcmPositionHierarchy where hcmPositionHierarchy.ParentPosition == workerAssignment.Position && hcmPositionHierarchy.Position == _positionRecId && hcmPositionHierarchy.ValidFrom <= now && hcmPositionHierarchy.ValidTo >= now; return hcmWorker.name(); } |
Friday, 16 January 2026
Get Parent Position Worker Name from Current Worker Position | D365FO X++
In this blog, we explore how to fetch the Parent Position Worker from a Current Worker Position in D365FO.
The solution revolves around core HCM tables:
- HcmWorker,
- HcmPositionWorkerAssignment,
- HcmPosition,
- HcmPositionHierarchy.
Source Code:
Subscribe to:
Post Comments (Atom)
Get Parent Position Worker Name from Current Worker Position | D365FO X++
In this blog, we explore how to fetch the Parent Position Worker from a Current Worker Position in D365FO. The solution revolves around c...
No comments:
Post a Comment