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

917 Views Asked by At

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 proccessenter image description here

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

I have also looked at this post but it doesnt address the specific query I have around dynamic naming

2

There are 2 best solutions below

0
On

Have you tried to use "Process Instance Modification"? -> https://docs.camunda.org/manual/latest/user-guide/process-engine/process-instance-modification/ IMHO you could cancel the specific task by ID and instantiate a new one after the transaction point of the User Task. When instantiating, you can pass to the new process the variables needed from the old process

0
On

You don't need to make the message name unique. Instead include a correlation criteria when you send the message, so the process engine can identify a unique receiver. The correlation criteria could be

  • the unique business key of the process instance
  • a unique (combination of) process data / correlation keys
  • the process instance id

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