I want my RE Framework process which is running through unattended mode to be killed/terminated when an exception occurred in try catch block

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.

I will glad if anyone helps me with this

Hi

You can use the “Terminate Workflow” activity in UiPath to stop the execution of the current workflow and terminate the project.

@Krishnakanth_Mathi

I tried using the terminate workflow at first but unfortunately it is stopping that workflow and then it is retrying the same process again

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

@Krishnakanth_Mathi

@Krishnakanth_Mathi

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

Ienum_jobs(0) will give the first job

Hope this helps

Cheers

Hi @Krishnakanth_Mathi

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:

  1. Catch Block: Place your catch block where you capture the exception.
  2. 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.

Thanks!!

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.

@Krishnakanth_Mathi

  1. If the processes arw different use the process name as filter
    2 if processes are same then use the machine or user as filters

Cheers

1 Like

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

@Krishnakanth_Mathi

Release name is what you need to use

Cheers

Hi @Anil_G

I have used the Release name in get jobs but the output is not matching with the input datatype job of stopjob

Please find the screenshot

  1. Have used Getjobs activity to get the output of my desired Process to be terminated for which I have set the parameters in Getjobs as below screenshot


    Release Name should be the name of the Process which u wanted to terminate

  2. 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

The output of Getjobs to be used as input for Foreachloop activity in List of Items

Thanks @Anil_G for giving the glimpse on how to proceed further

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.