AX 2012: Get Worker Information for current user
To be able to get the Worker for the the current user in AX 2012 you can use the code below:
static void getCurrentUserAssociatedWorker(Args _args)
{
HcmWorker worker = HcmWorker::find(DirPersonUser::find(curUserId()).worker());
info(strFmt('Name: %1 ', worker.DirPerson().Name));
info(strFmt('Address: %1', worker.DirPerson().primaryAddress()));
}
static void getCurrentUserAssociatedWorker(Args _args)
{
HcmWorker worker = HcmWorker::find(DirPersonUser::find(curUserId()).worker());
info(strFmt('Name: %1 ', worker.DirPerson().Name));
info(strFmt('Address: %1', worker.DirPerson().primaryAddress()));
}
Comments
Post a Comment