How to get details like jobId, robotId, windows username

Hi

I created a logger using write text file and now need to insert details like jobId, robotId (if applicable), windows username into the log. How do I retrieve these values from workflow to insert.

1 Like

For process related activities, use Get Process activity and the fetch details like Job Id, Process name…

Hi @Manas_Mallick,

In order to get the current logged in user you could use:
Environment.UserName

4 Likes

Thank you

Hi,

I tried using Process.GetCurrentProcess.ProcessName and it gives me UiRobot as process name, when I try to get the id it gives me pid, I was hoping for jobid, robotId, file/process name which looks like the one below

{“processName”:“*******”,“fileName”:“Test”,“jobId”:“f6fb1782-5f82-4549-bf54-c5877745d53e”}

Have you tried using the GetEnvironmentVariables. You’ll retrieve the Windows Username. You can get also the ProcessId out of the Process. But what do you mean by jobid?

1 Like

I want to get an id for the robot/process being executed to uniquely identify a process in a custom log file.
As I checked the default log, it logs jobid, processName and fileName. On similar lines I wanted my log file to log. Although when I get process name from GetProcesses, it says UiRobot, however in the default log its the name of the project being executed.

That jobid is unique only if you’re using Orchestrator. Is this the case?

I am not at the moment(I should be after once I am done with the workflow), however even when I call the robot using REST I still get a unique jobId. So I was thinking in those terms.
Also is there any other unique id I can get identifying the robot and/or process?

Hope this xaml helpsTemp.xaml (6.0 KB)

Hey… Did you get the solution for this (jobid)?

I could only use Username and Robot Id Environment.UserDomainName+“"+Environment.UserName+”, Process.GetCurrentProcess.Id.ToString

Is there any way to get the JobId? Process.GetCurrentProcess does not have that.

Hello,

you can access the jobId via UiPath.Executor.ExecutorManager.Instance.Id.ToString() and assign it with an invoke code activity

1 Like

Hi @sapo
can you explain this with an example

Thanks
Ashwin S

anyone got any solution for getting JobId?

I get

'Executor' is not a member of 'UiPath'

Is there a new structure to this?

1 Like

In VBA you can use Application.UserName to get the user’s full name.
Is it possible to get the full name in UiPath also?

@badita
IS ProcessId unique? I mean whether we will get unique id for each trigger.

Hi,

I found a way to get the JobId of a Running process by using the Orchestrator API. This solution relies on the bot having access to reading Jobs info in Orchestrator, so if somehow this is not possible, this solution won’t work.

It basically uses an http GET request to get all the Jobs that are Running on the specific machine the bot is running. Then, the ‘key’ value that comes in the JSON response is the JobId of that process.

Here is the GetJobId.xaml (8.6 KB). To deserialize the JSON response, I used the ‘UiPath.WebApi.Activities’ Dependency. So the Missing Activity that might show you comes from that Package.

If you want, you can check all these other handy requests and OData’s URL Conventions for more info on other requests and how to apply queries on them.

I hope this will be useful. Cheers!

7 Likes