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.

Wednesday 7 February 2024

How To: Customize BankPaymentAdviceVendV2 SSRS Report

In D365FO, there are two versions available for bank payment vendor invoices. However, in the latest version, Microsoft has made it mandatory for users to utilize the Bank Payment Advice V2 report, as shown in the image below.








In this blog, we will discuss how to customize the BankPaymentAdviceVendV2 report step by step.

Step: 1
Create an extension of BankPaymentAdviceVendV2Tmp Table.






Step: 2
Create an extension of the BankPaymentAdviceVendControllerV2 class and write a COC for the getReportName() method. Design your new custom report to replace the out-of-the-box report.










Step: 3
Create an extension of the BankPaymentAdviceVendDPTransferQueryGenerator class and write a COC for addInsertionFeilds() and addProjectionFields() methods to initialize and map your custom fields, if any.

addInsertionFields Method: In this method you need to initialize your custom fields

addProjectionFields Method: In this method you need to map the fields of BankPayAdviceVendTmp (V1) in the same sequenece as provided in addInsertionMethod. It is simply assignment of the value through version 1 table to version 2 table.

Note: If you have customize field in BankPaymentAdviceVendV2Tmp table then you also need to extend BankPaymentAdviceVendTmp, so that you can map it in addProjectionFields method. Otherwise you won't pass the values in fields.




Step: 4
Now subscribe the getDefaultReportFormatDelegate() method and under VendPaymAdvice enum add the highligted code. 

















Step: 5
Duplicate the OOTB BankPaymAdviceVendV2 report.










Step: 6
Override insert() method event handler (onInserted) of BankPaymentAdviceVendTmp table, so you can assign value in version 1 table and map it in projection fields method as show in step-3 image.

















Step: 7
Now just we need to select report format design from Print management setup (Account Payable -> Setup -> Forms).










That is all you need. Cheers!

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...