NameAlias lookup/reference for workers

For our workers, where these need to be selected, we would like to show the NameAlias instead of the Name field (note: this is a requirement as we like to lookup workers by first name and other “persons” by last name; there is slightly more to it but this should give you some context).

After some fiddling, I managed to create a custom lookup form for workers, which nicely holds the personnel number and the namealias as I wanted.

However, when I add (for instance) a reference control to a form, linked to a field that holds a HcmWorkerRecId, the Name is still shown in the control itself instead of the NameAlias. It appears this has to be changed through the ReplacementFieldGroup, but since NameAlias is not part of the HcmWorker table itself, I’m having trouble figuring out how AX chooses the field(s) to display in such a control.

What I tried: created a display method in HcmWorker table, called alias, added this to a Field Group and tried that as the ReplacementFieldGroup. The result was that the control was simply hidden. Trying to turn it into an edit method presented its own challenges, and first indications were this will not make things better.

So: can anybody explain to me how, for this particular case (a reference control on a form from a datasource and datafield of EDT HcmWorkerRecId), AX chooses “Name” (from DirPartyTable) as the field to display in the control. Some steps of “redirection” appear to be taken, but I cannot figure them out, let alone find a way to alter them.

Once this works, I hope to alter the lookup to also work with a filter (if the user enters part of the name and then an asterisk) intuitively, so if you have any suggestions in that direction they’ll also be appreciated.