What is the use of Get Jobs Activities?

Hi Team,

I have used Get Jobs Activities which linked with orchestrator. I filtered with command “State eq ‘Faulted’” which produces its output in variable totalJobs. But while i print it, It displays the below message
UiPath.Models.OrchestratorJob[]
I want to retrieve only the Process Name from total jobs. I am using it for auditing purpose.

Thanks in advance
Baskaran Chidambaram

Hi.

I believe Get Jobs stores the result into an enumerable / array type. So, to output the results you need to do one of the following:
—join the list to a string like this: String.Join(",",jobsVariable.Cast(Of String()))
or —use a For loop to extract each item like this: For each job In jobsVariable

However, I’m not that familiar with the activity and accessing the details from each job, so I am not sure I provided the solution that gets you the information you need, but should atleast get rid of the OrchestratorJob thing that you received (which happened because you use jobsVariable.ToString, but it’s an array so you can’t do that and need to reference an individual item in the array if that makes sense).

Regards.

1 Like

What ClaytonM said is correct, it returns an ienumerable of type OrchestratorJob.

Generally you’d use a for loop to go through your ienumerable to filter things out and process whatever you need.

ProcessName is one of the properties in an OrchestratorJob variable, so if you just wanted to print out all the process names you would do the following:

  1. Get jobs -->Output totalJobs
  2. For each job in totalJobs (of type OrchestratorJob)
    2a. Write Line job.ProcessName
1 Like

Hi ClaytonM and Dave

Thanks a lot for your answers. But still i can’t able to fetch exact details
Please find the below image

job.ProcessName throws error during development. Error is Option strict on disallow late binding

image

Thanks in advance
Baskaran C

Be sure to change the ‘for each’ property so the TypeArgument is UiPath.Models.OrchestratorJob

Hi Dave,

Still facing issue in this part. Need your guidance on this more…

Regards,
Baskaran

No problem. I attached a couple of pictures which should help illustrate.

The first one is the properties window of the For Each activity. Notice that the TypeArgument was changed to be UiPath.Models.OrchestratorJob

TypeArgument%20property%20in%20For%20Each%20activity

This next picture shows the For Each activity. Notice how there is a dropdown menu now when I input job. This shows the list of methods and properties for the individual OrchestratorJob. If you select job.ProcessName, it will return the name of the process within Orchestrator as a string.

For%20Each%20activity

1 Like

Thanks a lot @Dave
Your Solution resolved two of bugs.
Thanks again.

I am not ble to get ‘UiPath.Models.OrchestratorJob’ in the Type Argument of ‘For Each’. Could anybody please help me on this issue.

Its should be “UiPath.Core.Activities.OrchestratorJob” in the Type Argument of “For Each”.

1 Like

Hi Dave,

Thanks for everyone help. I’m facing that issue now, I do have the new Type which is pointed by @suresh_polinati at the bottom but, my issue now is that I’m showing an error like this:

Get Jobs: Operation returned an invalid status code 'BadRequest

All Job Folder permissions are set up which according to the forum should be the reason why it gives this issue.

I’d appreciate any thoughts…

@MARIODC could you upload a screenshot showing the inputs to your get jobs activity?

The BadRequest status code usually means that you have one or more missing or invalid parameters that the API requires. Unfortunately there isn’t very good or easy-to-find documentation explaining the required syntax.

I don’t think it has to do with permissions as that would usually throw a different error ‘Forbidden’

Hi Dave,

You can see the chat flow here :slight_smile:

Fortunately, the ‘Bad Request’ is good now, it was a matter of removing ‘Jobs’ from Misc properties. Although, entering “Default” on the same pace that is ‘Orchestrator Folder path’ it gives no error.

The problem now is that it show no Results:

BTW, For each argument is type as img below:

image

Regards,

Yes you should be leaving that Orchestrator Folder misc parameter blank. Unless you have altered your orchestrator from the default settings, this should remain blank.

Can you show me the orchestrator page that your studio robot is connected to? Your filter is only pulling successful jobs and I just want to verify that it is indeed showing Successful jobs in Orchestrator. Note that if you’ve only run jobs so far via studio then nothing will be showing in orchestrator

Hey Dave,

I agree with you. I do hage some jobs row displayin on Orchestrator.

Please notice these:
•changed Environment name from ‘Demo Environment’ to ‘Enviroment’
•using classic folder
•Changed from ‘Studio’ Robot to ‘Unattended’ Robot
•I just ran a few jobs and then stopped them to make a few rows but there is one ‘Successful’ though

Thx

Good news, now is showing data finally using proper Filters but:

•How would you get all from folder just as it was a regular SQL (Select * from…) query?

Thx Dave,

If you want to select all jobs, then you should remove filters entirely and leave that section blank. This will get all the jobs. I am unsure if there is a limit to how many it will retrieve though, you would have to experiment with that.

Note that this isn’t equivalent to SQL at all. The orchestrator API uses Open Data protocol (OData). This can be filtered with the URI conventions mentioned in part 4.5 here: URI Conventions (OData Version 2.0) · OData - the Best Way to REST - they are what you put into the ‘filter’ section of the get jobs activity.

1 Like

Thanks Dave, great info!

image

1 Like

It appears it will return a maximum of 100.

1 Like