Camunda: how to cancel a human task via interrupting boundary event?

I have a simple BPMN flow where on instantiation a human task gets created. I need the ability to cancel / delete the human task whilst the process instance is active and the workflow moves to the next logical step. See attached proccess

I am considering using an interrupting boundary event with a dynamic message name so that I am sure of only cancelling the specific task. I may have multiple instance of the same task type within a single process instance and need the ability cancel each individual task instance. I am trying to have a general pattern for cancelling only the specific task (identified by the task ID, for example). Hence, I would like use the ID of the task in the message name of boundary event. Is that possible?

Otherwise, what would be the best approach for achieving the desired outcome of being able to cancel / delete a specific task?

test-process.bpmn (4.6 KB)

Hi @maheshsubramanian
I’m just wondering who is the user that would cancel the task? Is it done by the user themselves or by an external admin?

@Niall We will need to support both scenarios. Either assigned user or user with privileges can delete or cancel a task.

Just pinging here to resurrect this thread. I have explored a second option using conditional boundary event attached to the user task. On detecting a variable presence (e.g., variable with name deletionReason with any value as this is user driven), we interrupt the task (deleting it in the process and triggering the attached delete task listener).

However, we wanted the approach to be generic and thought of updating local variable (deletionReason) on any task. This is not triggering the conditional boundary event. If we update the variable on the task, this is cancelling all the user tasks within a process instance as they have the same condition triggering the conditional boundary event. Is there a way where by we can have have a standard approach for deleting user tasks and only that specific task instance within a process instance?

Hello @maheshsubramanian ,

modifying the message name in a dynamic is not what you are looking for I think.
Here, you can use the ability of a message correlation to be specified with business key, process instance or some variables that need to match.
So, many message events waiting for the same message can exist and the sender needs to specify by these variables where to correlate the message.

A link to the rest api doc:

https://docs.camunda.org/manual/latest/reference/rest/message/post-message/

Hope this helps

Jonathan