How to get current jobID and robotName from studio

hi
there is a question about i want to get current jobID and robotName from studio
without calling orchestrator api
because execution log file has all these default logs
so i think there might be a way to get jobID and robotName
please help me , tks

1 Like

Hello,

For the machine name : Environment.MachineName but i don’t know with the JobID

Hi
Welcome to UiPath community
We can use Get Environment Variables activity to get,

  1. MachineName
  2. UserName

And to get the JobId
Kindly have a view in this
I haven’t used this, but let’s give a try

Cheers @suzchang

thanks for your reply
but i have already seen this article
UiPath.Executor.ExecutorManager.Instance.Id.ToString() cannot work
it will return exception → ‘Executor’ is not a member of ‘UiPath’
and the other way is calling orchestrator api
but i have more than one robot is running, calling orchestrator api is not adoptable for me

do u have another suggestion? tks

1 Like

Is there a solution yet?

Hi @neriaa, welcome to forum did u tried orchestrator API ?

Hi Nived,
Thank you for the reply.
As far as I understood, Orchestrator API method gets the Job Ids of the Jobs that are currently Running on the specific machine, but not necessarily the JobId of the current Job. Is this correct?
I’m afraid it could cause problems if more than one Job will be running on the same machine. Is it possible? and if so, is there an alternative solution?

Hi
Could you find any solution?

Thanks

I know this is an old thread, but I figured I would add a current solution. Runtime Activities will help solve this problem.

The following are available:

  • GetProcessName: Retrieves the name of the process. If running from Studio, this will be the project name. If running via Orchestrator, this will get the process name as defined in Orchestrator.
  • GetProcessVersion: Retrieves the version of the process (as defined in the process’s project.json file)
  • GetJobID: Retrieves the unique ID of the process. This job ID also appears in the execution logs.
  • GetInitiatedBy: Retrieves the means by which the process has been started. Can be StudioPro, StudioX, Assistant, Orchestrator
  • GetWorkflowFilePath: Retrieves the path of the file that is currently executed.
2 Likes

Update. This wont return you a JOB ID. It returns job key, wich can help you to get ID of the job. Example of return value is ‘f942c40f-fd5c-48dd-bde1-3c78252c8ca6’, you can also verify this with swagger.
image

To get ID of job (for example to get logs for this job via API request) use this value with OData filter “Key eq f942c40f-fd5c-48dd-bde1-3c78252c8ca6” (i used my job-key). That will return you a job frow wich you can take an id of it.

Here is the ID;