Monsieur Winner

MS D365FO || Monsieur D365FO

Technical

Retrieve employee first, last name, middle name X++ / D365FO

There have been many occasion where, we need to split and return employee FirstName, LastName or MiddleName.

This could either be on a form or most times on a report. The below code should help.

DirPersonName dirPersonName;
DirPerson dirPerson;

dirPerson = DirPerson::find(HcmWorker::findByPersonnelNumber(this.PersonnelNumber).Person); // Get the HcmWorker record.
dirPersonName = DirPersonName::find(dirPerson.RecId);

this.FirstName = dirPersonName.FirstName;
this.LastName = dirPersonName.LastName;

Merci

Komi Siabi

Komi Siabi is a Bilingual D365FO Solution architect who loves sharing his knowledge as he works on Both Francophone and Anglophone projects around the globe. He enjoys doing some tiktok videos in his leisure time.

Leave a Reply

Your email address will not be published. Required fields are marked *