How to stop a task

Hi All,
When the program meets the conditions, i want to stop the task.
I learned that try catch activity should be used, but I don’t know how to do it.
Please give me some sample, thank you!

Hey!

Could you please elaborate a bit more?

What kind of condition you’re talking about?

can we try like this:

  1. Use Stop Job Activity to stop on Orchestrator

  2. Use Terminate Workflow Activity to end the process flow

Regards,
NaNi

Hi @Chen-Jim ,

Use Stop job activity to stop the execution over Orchestrator.

Activity:- UiPath.Core.Activities.StopJob

Hi NaNi,
I do not used orchestrator in my program, when the program meets the conditions, terminate the program.
According to your suggestion, how to use Terminate Workflow Activity.

Hi @sachin.lather ,
I use the stand alone studio, not used oc.

Hey!

Reference:

Regards,
NaNi

Hi @Chen-Jim,

then for stand alone studio you can you can do it through both the methods manual as well as by using ui path activity.

For manual process you can simply click break or stop button under Debug menu.

For Ui path Activity you can use Should stop activity.It requirs your studio connected with Orchestrator.
Activity: UiPath.Core.Activities.ShouldStop

or You can use Kill Process and Terminate Workflow for that if you want to end Process at any Specified Point.

Activity : UiPath.Core.Activities.KillProcess

Acitivity : System.Activities.Statements.TerminateWorkflow

Hey! @sachin.lather

The case is different… This won’t work here…

As per the requirement the bot is running in the machine.we can’t stop the bot in the debug mode…(This is manual process)

The requirement is to stop the bot automatically not manually…

We’re not using Orchestrator as well… Should stop won’t work here…

We can use only Terminate workflow

Regards,
NaNi

Hey @THIRU_NANI,

Agree with you but @Chen-Jim did not mention clearly what he wants to do.

Regards,
Sachin