Cancel workflow Don't want to loose the history of already completed tasks and stop showing in the tasklist

Some times, part way through a workflow, we want to abandon it. At that point we want to cancel all active tasks. However, we don’t want to loose the history of already completed tasks, so deleting the workflow instance seems wrong. We thought that suspending the instance might be the best way, but it now seems not? What would be the best way to ‘archive off’ this instance that we’re giving up on, so history is kept, but tasks stop showing in the tasklist?

If you delete the process instance through the RuntimeService, the history will remain in place for the process instance, which means the task information is still in the history tables if you need it.

Instead of deleting the process instance, I would prefer to add an option in the process model to “abandon” it, for instance using something like a boundary event on a subprocess or an event sub process applied to the scope that allows somebody to abandon it. That way, the process instance comes to a natural end and history will also remain available and show the actions that were taken.

A reason to choose between one or the other approach would be whether you consider abandoning the process an operations intervention (delete) or a functional case that needs support (bpmn model).

I don’t think Tasklist supports displaying historic tasks, but the history tables still have the information.

Suspend is not a good match for your use case, because that just “pauses” the process instance, with the expectation that it will be resumed later on. In that case the process remains in the runtime.

3 Likes

Thank you @tiesebarrell. This is really helpful. I have used RuntimeService approach and that fulfill our requirement.

1 Like