How do you retrieve the username that triggered an orchestrator job?

I have use case where I need to determine the username that triggered the job to determine specific handling based on the Orchestrator user that triggered the job. I attempted to use the “Get Current Job Info” as it states it should be able to return the username, but I do not see how to retrieve it in Studio. I only see WorkflowName, ProcessName, ProcessVersion etc. but no Process Username.

Get Current Job Info (uipath.com)

Studio version 21.10.5 enterprise

Just an example of what I’m seeing.

image

Environment.Username

Hi Paul, I’m looking for the UiPath Orchestrator username not the windows username. We have an unattended robot, which is typically triggered by a schedule, but can also be triggered manually. I need to identify the Orchestrator account that initiated the task for slightly different handling.

@tboyd8007 Environment.Username will give the name of the user who logged into that windows server. So, when the unattended bot logged into that server it will give the bot name. You can try it

The Windows username IS the username that Orchestrator uses to log into the machine to run the unattended automation.

Hi Usha, our users do not have access to the server where the process is running and are initiating it from Orchestrator. The process runs under a service account so unfortunately getting the windows username would not be helpful. We were asked if it was possible to handle a small portion of the tasks differently when triggered manually. I was hoping to trigger this based on the username that initiated the job rather than providing a config file or argument. According to the Get Current Job Info activity this should be possible but I’m not seeing it.

@tboyd8007 Sorry to bother on this. But I guess that exp will give you the unattended bot name that you are looking for(we have used the same exp for one of our project) . You can try this

  • Create a new project, within that take a log message which has that exp
  • Publish this code to the Orchestrator
  • Schedule that process and see thatwas giving the bot name which is currently running that process

Hi Usha, thank you for your advisement on this, I’ve used the environment.username before. Unfortunately in this instance, the environment.username would return the service account username the robot utilizes and not the username of the person logged into Orchestrator who started the job manually. UiPath’s documentation says this should be possible but I’m not seeing a way to pull in the actual Username and wasn’t sure if there was another way to retrieve it. I was hoping to test this to see if it indeed retrieves the username who initiated the process or the user id that is running the process, as I need the former not the latter.

Is this something you have come across before?

UiPath.Core.Activities.GetCurrentJobInfo

Retrieves information such as Process name, Workflow name, User name, User email, and Timestamp from the current Orchestrator job.

Hi Paul, yes that would normally be the case. This is one of our last classic folder models that is running under a dedicated service robot account and has no tie back to the user. We were trying to find a way to meet the needs of the request prior to migration to modern folder and modern robot license assignment.

I believe I too am looking for the same answer. What I need is, the AD account user name that manually kicked off the job in orchestrator and not the user name that is actually running the job (which in most cases will be service accounts).