I’m trying to terminate my process when an exception is captured in catch block for this I have tried using stop job activity fir which it requires jobid so I have used start job activity to capture it but the output of start job is string, this datatype is not supported to stopjob. Stopjob is expecting the datatype as orchestratorjob. For reference i have added a screenshot.
Then use n number THROW activity in all the following catch blocks you have with any sort of exception defined like New system.Exception(“any exception message”)
You have to use get jobs activity…which will give you enumerable of orchestratorjob…from
That filter the job you need or add the filter in the get jobs only and then use the output in stop job activity
I understand that you want to terminate a process when an exception is captured in a catch block within your UiPath workflow. To achieve this, you can use the “Terminate Workflow” activity instead of trying to stop the entire job.
Here’s how you can do it:
Catch Block: Place your catch block where you capture the exception.
Terminate Workflow Activity: Inside the catch block, add a “Terminate Workflow” activity. This activity will terminate the current workflow without affecting the entire job.
Configure the “Terminate Workflow” activity to handle the exception. You can use an If condition to check the type of exception and decide whether to terminate the workflow or handle it differently.
For example, you might check if the exception is a specific type that requires termination, and if so, set the “Result” property of the “Terminate Workflow” activity to “Faulted.” If it’s not the specific exception you want to terminate for, you can choose to handle it differently.
Hi Anil,
Thank for the input, but the point is its a scheluded process/job at the same time we triggered another 3 jobs how can the bot identify exactly my job to terminate or stop that job. I thinks ots not possible that always my job will be comming in order of (0).
Hi Nitya, i want to terminate the entire job there is no point in terminating only the workflow. There are frequent changes in website so if a change happens in website my bot should be stopped, i dont want it continue for the whole day to run waste the bots.
Do we have any other activity which can terminate the entire job.
Hi @Anil_G ,
Thanks for the info.
I tried using Getjobs earlier but haven’t seen any option to select the process name so i have used startjob to get the jobid for specific Process.
I don’t see anything like Process name in the filter in Getjobs, can you please be more specific.
Please find the attachment for the same
Release Name should be the name of the Process which u wanted to terminate
Then later have used the foreach loop activity to Terminate the process when the element is not found. Please find the below screenshot that how I have added the logic