≡ Menu

Current user and its employee Name and department

Today I got small requirement where I have to pick and display current log in user Name, Following code snippet helps me

static void curUserInfo(Args _arg)
    str sUserId;
Name  name;
str departmentName

    sUserId = curUserId();
    info( "Current user ID is " + sUserId );
name= HcmWorker::find(DirPersonuser::findUserWorkerReference(sUserId)).name();
 departmentName=    HcmWorker::find(DirPersonuser::findUserWorkerReference(sUserId)).primaryDepartmentName();
info ("Name is " + name);

{ 0 comments… add one }

Leave a Comment