How to get details like jobId, robotId, windows username

studio

#1

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.


#2

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


#3

Hi @Manas_Mallick,

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


How get robot name?
#4

Thank you


#5

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”}


#6

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?


#7

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.


#8

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


#9

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?


#10

Hope this xaml helpsTemp.xaml (6.0 KB)


#11

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


#12

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


#13

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


#14

Hello,

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


Find out which job a robot is working on