cancel
Showing results for 
Search instead for 
Did you mean: 

Can I end or cancel a ProcessInstance while running?

iammjj
Champ in-the-making
Champ in-the-making
Can I end or cancel a ProcessInstance while running?
In my system, I need to end or cancel a processInstance whenever a task returned error. But it's so ugly a workflow if I connect every task to the errorEnd node.
How can I do it ?
Thanks
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
You can use the RuntimeService to end a workflow, using deleteProcessInstance, where you can provide a reason. The process will end, and if you wish, you can add an execution-listener (to process end) to cleanup some resources for example, after the process ended. In the listener you can inspect the deleteReason, so you can act accordingly.