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).

Any information on the above?

Again, this is what I’m looking for.

  1. User X logs into Orchestrator.
  2. User X starts a job.
  3. The job logs into a machine using the required credentials it needs to complete the job. This credential need not be the same as User X.

In the above scenario, we want to find out who that “User X” is, so that follow up can be done. Say for example, notify User X that the job he started has completed successfully or failed.

there were some techniques by using the audit logs via REST API for extracting the starter user
There were some ideas to bring it it upcoming versions into the get current Job Info activity (but the idea / thinking about let us not derive when it will be done and if)

Sorry to say , but you are not understanding the question itself.
People know what Environment.Username does and how can it be used, but thats not the question here !

The question is to know the Name of the person who started a job from orchestrator if the job was triggered manually !

At the moment, this can be fetched using Orchestrator APIs to look for the Audit logs and filtering them on the process name and time to get the latest audit log that was generated for a job start for that particular process.

but thats not fully efficient !

as menitoned

with a preview

which was mentioned from UiPath Side

If a wider demand can be encountered the feedback category could be used for a central user voice collection on this feature

1 Like