Announcements
Hi Guys,
I want to retrieve the Worker personnel number from CurUserId . Can you please advice on this.
*This post is locked for comments
Hi Michael,
You can get the record ID of the current worker with the command 'currentWorker()'. If you have a user ID, you can also use HcmWorker::userId2Worker() to get a record ID of the worker. Once you have the record ID, you can also retrieve the personnel number.
Create a job and paste the following recommended code:
HcmWorker hcmWorker; select * from hcmWorker where hcmWorker.RecId == hcmWorker::userId2Worker(curUserId()); info(strFmt("%1", hcmWorker.PersonnelNumber));
OR use the following code for more clarity of the tables,
DirPersonUser dirPersonUser; DirPerson dirPerson; HcmWorker hcmWorker; select * from dirPersonUser where dirPersonUser.User == curUserId(); select * from dirPerson where dirPerson.RecId == dirPersonUser.PersonParty; select * from hcmWorker where hcmWorker.Person == dirPerson.RecId; info(strFmt("%1", hcmWorker.PersonnelNumber));
You can also use
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.
Jump in, show your community spirit, and win prizes!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CP04-islander 21
dekion 4
Virginia99 4