You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to get logged in user id

Accepted answer
52
Views
3
Comments
edited Sep 20, 2019 3:23PM in Agent Desktop 3 comments

Summary

How to get logged in user id from custom process

Content

Hi,

We are trying to populate a field ($workOrder->Resource) with the name of the last user who updated the object. But when we test it we noticed that it only works in the first time when the object is update, the following times it doesn't populate wich account have updated the field.
Can you help me identifying if there is anything wrong in the code?

 public static function setResourceToWorkOrder($obj,$act){
        if (RNCPM\ActionUpdate == $act){
            $workOrder = RNCPHP\TOA\Work_Order::fetch($obj->ID);
            $account = RNCPHP\Account::fetch($workOrder->UpdatedByAccount->ID);

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!