How to get current user worker in X++


The code to get current user.

curUserId()

The code to get current user worker.

Option 1:

HcmWorkerRecId   hcmWorkerRecId =  HcmWorkerLookup::currentWorker();

Option 2:

HcmWorkerRecId   hcmWorkerRecId =  HcmWorker::userId2Worker(curUserId());

The code to get current worker name

DirPartyName workerName = HcmWorker::worker2Name(HcmWorker::userId2Worker(curUserId()));

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: