Get employee year of service in D365FO – x++
Recently, I worked on an Integration which require employee to book loans and rent advance directly from D365FO and these requests hit the clients core banking application.
One of the requirement is the employee must have served a certain number of years to access these loans. This is actually shown on the employee details card as below:
To get the employee service duration via code, we do:
HcmWorker hcmWorker;
Hcmemployment hcmemployment;
real YearsOfSerrvice ;
select hcmemployment where hcmemployment.Worker == hcmWorker.recid;
YearsOfSerrvice = hcmemployment.yearsOfService();
Merci.