Keep track of user that cancels/ends process

Is there an easy/recommended way to create a process that can be cancelled/ended at any point by a user?
It’s also important that the user that “cancels” the task is recorded in the archive table, so I can’t just delete the task entirely.

I’m aware there is cancelProcessInstance in the API but this has no option to keep track of a user. I know I have the option of creating a separate “End Process” Task that could transition directly to a Terminate End Event, but then multiple tasks will show up in the Portal for users, which is a little confusing.

Thanks

Instead of a task I recommend to use a catch message event. Catch message event will wait for a message sent from another process. The user who want to cancel a given process instance can start this process dedicated to cancellation by selecting the process instance to cancel.

Doing so will track who cancel a process instance (it is the user who initiate the cancel process).

I create an example to illustrate that.

Just so you know, when I try to import that .bos file, Bonita studio says “This BOS archive is not valid.”.

In my system, it was easiest to have cancellations associated with the original process instance. I ended up doing a sort of hack where I assign the user who is cancelling the task, to the task, as they cancel it. This makes it so that in the archive flownode table, there is a record of the flownode instance beind cancelled, and the assignee id is the user who cancelled it. It’s not perfect but it was very easy to implement and works well with the rest of my system. When I have a more complex system in the future I will definitely use the message idea, that makes more sense and is a lot more scalable.

Thanks!

Thanks a lot for the feedback.

Can you let me know in which edition and version of the Studio did you try to import my example? I create it with Bonita Studio 7.8.3 community edition.

Bonita Subscription - Enterprise
Version : 7.8.2
Build id : 7.8.2

Ok thanks. That was an issue on version 7.8.2 that is now fixed on 7.8.3.