Terminate workflow

I want to terminate the workflow at specific time .
I have used terminate workflow activity in invoked workflow.
i want my workflow should terminated without message box.
To catch the message box i have used try catch in my first/main workflow if i use this main workflow is still processing with next step of activites.
i want my main workflow and invoked workflow to be terminated without message box .
can anyone help me on this?

2 Likes

If it is an Unattaended Robot you can use Should Stop instead of Terminate Workflow.

now.Hour >12

Should Stop

I thought Should Stop was only used to trigger actions if you choose Cancel (instead of Terminate) in Orchestrator. Maybe I misunderstood.

Cancel command can be sent only through Orchestrator.
It sets a bool in UiRobot service for that particular job - nothing else.

Terminate command kills the robot process (via UiRobot service).

ShouldStop (which btw has a wrong Result description in Activities Guide) checks that bool and returns it’s value. It can be used for flow control to branch out of execution, but by itself it does nothing if not taken into account in transitions.

You need to branch your execution to an end if you catch a WorkflowTerminatedException. Add a separate catch clause for it, set a bool flag there and add a transition to an end for it.

3 Likes

Its me.:roll_eyes:

Thanks andrzej and vvaidya. So ShouldStop works for both Cancel and Terminate (including Terminate activity). I assume that’s what you were saying.

Seems like to me he would need to check the time at certain parts of his workflow then perform Terminate and ShouldStop if desired to close out windows.

But I don’t know if that’s ideal if he is wanting it to end right at that time no matter where it is in the workflow.

There is also the option in Schedule section of Orchestrator to end after certain amount of time.

This is also a good idea assuming it is an unattended robot.

Not quite. Cancel sets result of ShouldStop to true. Terminate just kills the robot outright - no checks, no conditions.

I agree that ShouldStop-like design would be best. Taking as example UiPath’s built-in Sample Business Process state machine, a check for time before getting next transaction → additional transition to end state. Not much point in stopping in the middle of a transaction.

But we’ll need to wait for the OP to see what he really wants.

1 Like

Ok, then my first understanding was correct. Thanks.

1 Like