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()));

}

Comments

Popular posts from this blog

AX 2012 R3: Cannot edit a record in Purchase order - update table (PurchParmTable).

AX 2012: The AOS server name or instance name is not correctly configured

AX 2012 Get Financial Dimension Value by Worker RecID