Announcements
No record found.
So i have a certain personnel number (not the current worker) and i want to get it's user Id, how can i do that?
i found a method to find the opposite which is HcmWorker::userId2Worker() but i want from worker to user
Hi JuniorAX,
Can you try statements below
info(strFmt("%1",DirPerson::find(HcmWorker::findByPersonnelNumber("000123").Person).Name));
info(strFmt("%1",HcmWorker::findByPersonnelNumber("000123").RecId));
info(strFmt("%1",curUserId()));
select * from UserInfo where UserInfo.id == curUserId();
if(UserInfo.id != '')
{ info(strFmt("%1",HcmWorker::findByPerson(DirPerson::find(DirPartyTable::findByName(UserInfo.name).RecId).RecId).PersonnelNumber));
}
Reference:
aspcodder.blogspot.com/.../how-to-get-hcmworker-name-and-id-in-ax.html
You can get it from DirPersonUser table. Hcmworker has relation with dirperson and dirperson has releation with Dirpersonuser table , so just look at relationship ,build your query and get the result.
Hi Junior_AX,
Please let us know if you have any further questions on this thread.
Thanks,
Satish Panwar
Please help verify answer(s) if they guide you in right direction so other community members can also benefit from your question with verified answer.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to a top community star!
In our never-ending quest to help the Dynamics 365 Community members get answers faster …
Welcome to the next edition of the Community Platform Update. This is a status …
Stay up to date on forum activity by subscribing.