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