Wednesday 28 February 2024

Unlocking Worker Insights: Exploring Data Retrieval from Various Tables via HcmWorker in D365FO

During the development or customization in the Human Resource Module, we often required access to various tables' data to use in different functionalities. In this blog post, I've endeavored to consolidate all the relevant tables that provide data for the Human Resources module's displays and operations.

Note: The tables data below have been selected based on the HcmWorker table.

Get HcmWorker Table from Personnel Number: HcmWorker hcmWorker = HcmWorker::findByPersonnelNumber('00006');

Get Active HcmEmployment Table from HcmWorker Record Id: HcmEmployment hcmEmployment = HcmEmployment::getActiveEmploymentsByWorker(hcmWorker.RecId);

Get DirPerson Table from HcmWorker: DirPerson person = hcmWorker.DirPerson();

Get DirPersonName Table from DirPerson Record Id: DirPersonName dirPersonName = DirPersonName::find(person.RecId);

Get HcmPersonPrivateDetails Table from DirPerson Record Id: HcmPersonPrivateDetails personDetails = HcmPersonPrivateDetails::findByPerson(person.RecId);

Get HcmPositionWorkerAssignment Table from HcmWorker Record Id: HcmPositionWorkerAssignment positionWorkerAssignment = HcmPositionWorkerAssignment::getActivePositionWorkerAssignment(hcmWorker.RecId);

Get HcmPositionDetail Table from HcmPositionWorkerAssignment Position: HcmPositionDetail hcmPositionDetail = HcmPositionDetail::findByPosition(positionWorkerAssignment.Position);

Get HcmPositionHierarchy Table from HcmPositionWorkerAssignment Position: HcmPositionHierarchy positionHierarchy = HcmPositionHierarchy::findByPosition(positionWorkerAssignment.Position);

Get HcmPositionWorkerAssignment Table from HcmPositionHierarchy ParentPosition: HcmPositionWorkerAssignment parentPositionWorkerAssignment = HcmPositionWorkerAssignment::findByPosition(positionHierarchy.ParentPosition);

Get LogisticsPostalAddress Table from DirPerson Record Id: LogisticsPostalAddress logisticsPostalAddress = DirParty::primaryPostalAddress(person.RecId);

Get HRMCompFixedEmpl Table from HcmWorker Record Id and HcmPositionWorkerAssignment Position: HRMCompFixedEmpl fixedCompensation = HRMCompFixedEmpl::findMostRecentFixedCompensation(hcmWorker.RecId, positionWorkerAssignment.Position);

Get JmgEmployee Table from HcmWorker Record Id: JmgEmployee employee = JmgEmployee::find(hcmWorker.RecId);

Get HcmPersonDetails Table from DirPerson Record Id: HcmPersonDetails hcmPersonDetails = HcmPersonDetails::findByPerson(person.RecId);

Get HcmPositionType Table from HcmPositionDetail Position Type: HcmPositionType positionType = HcmPositionType::find(hcmPositionDetail.PositionType);

That's all for now. I hope you find this information helpful.

No comments:

Post a Comment

Key Updates in Dynamics 365 F&O for Version 10.0.39

Here’s a concise summary of the  platform updates  in  Microsoft Dynamics 365 Finance & Operations version 10.0.39 (March 2024) : 1- Add...