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.
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).
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:
Get jobs -->Output totalJobs
For each job in totalJobs (of type OrchestratorJob)
2a. Write Line job.ProcessName
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
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.
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.
@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’
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.
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
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
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.