Output parameter of task is set even on interruption

I observed a behavior of the process engine (using Camunda 7.10) that surprised me and my teammates and I’d like to understand the reason for this.

Consider this fantastic process model with an active instance waiting for the user task to be performed:
image

We intended to set a process variable only if a task is completed.
So we added an outputParameter (docs) to it like this: starsAndLollipops: true

If the task gets interrupted by sending the boring message to the boundary message event, the variable starsAndLollipops is set to true anyway. We all expected the output parameter would not be applied in this case.

In order to follow this condition I changed the expression to ${execution.isCanceled() ? true : false}

  1. Does execution.isCanceled provide the correct condition for our scenario?
  2. What’s the reasoning for this behavior?
  3. I’m sure this is part of the documentation but just to better handle it next time, where can I find it?

Thanks a lot

Daniel

out-par-test.bpmn (4.1 KB)

hum, i experienced a similar behaviour.
In a transactions, the “output” is evalued even if transaction got canceled.

https://forum.camunda.io/t/canceled-task-in-transaction-but-output-is-still-evalued/23826/6

The Camunda Support recommended using a TaskListener for the completion event which is only triggered when the task gets completed by a user (I even use TaskListeners in other contexts… :man_facepalming:)

This is exactly what we want and has the additional benefit of not even creating the process variable in other cases (as opposed to setting it to false using the output).

This truly is a fantastic process model - In some ways I wish that starsAndLollipops could never be set to false…

1 Like