Trying to implement automatic task unassignment with condtional events


I’m trying to model the following behaviour:
“If a user assigns a task to itself and doesn’t complete it after a certain time, the task is automatically unassigned (or re-created)”.

I thougth that I could model it with a variable “task_assignement_status” with possible values “assigned”, “unassigned”, “(assignation) expired”, and conditional events. Something like this:


The variable is initialized inside the start execution listener with value “unassigned”, then changed to “assigned” (or again to “unassigned”) inside the assingnment task listener. And it is also set to “expired” inside the timer end listener.

The problem is that the variable changes that are done inside the assignement listener aren’t triggering any conditional event. I don’t know if this is expected behaviour, me doing something wrong, or a bug. Nevertheless, if I do the variable change manually using Cockpit I see the conditional events being triggered.

Also, I would like to ask if there is a better or easier solution to model this. For the moment as a workaround I’m just using a boundary interrupting timer that goes back to the task, and that is initialized with a very long time period (ideally I wouldn’t need a timer if the task is not assigned), then changed dinamically to a shorter time when the task is assigned (inside the asignement listener) using Java delegation code (and changed back to the long time period if it is unassigned again).

Thanks in advance.

Hi @Carl,

If you can reproduce this by providing a unit test, then that would be helpful for error analysis. You can use the unit testing template to get started: GitHub - camunda/camunda-engine-unittest: Unit test template project for camunda engine

An alternative could be to model the reassignment as a separate process, like this:


Whenever a user is assigned, you start a new process instance referencing the process instance with the user task. In Reassign, you reassign the task via TaskService API if it still exists. If the task is completed or reassigned in the meantime, you delete this process instance.

That way, you do not have this behavior as part of the process model, which can be nice if you want to apply this pattern to a lot of user tasks.


1 Like

Thank you Throben,

So I will try to reproduce it on a unit test.



Here is a simple Unit Test that works with the following diagram:

testProcess.bpmn (4.3 KB)

The conditional boundary event should trigger after the variable is created/changed inside the assignement listener, and after the process terminated. The problem is that the conditional event is never triggered.

I have also verified that if I create the variable inside the init execution listener, this works as I expected and the process is terminated.

/* Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an “AS IS” BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.
    package org.camunda.bpm.unittest;

import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;

import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;

import org.junit.Rule;
import org.junit.Test;

public class TestConditionalEventInAssignmentListener {

public ProcessEngineRule rule = new ProcessEngineRule();

@Deployment(resources = {“testProcess.bpmn”})
public void shouldExecuteProcess() {
// Given we create a new process instance
ProcessInstance processInstance = runtimeService().startProcessInstanceByKey(“testProcess”);
// The task is created and the assignment listener called This is because we have an Assignee
// in the .bpmn file.
// Process should be terminated


Thank you. This is a bug and I raised a bug issue, see


Hi @thorben

Has this bug been resolved ? I am experiencing the same issue.


Hey Zishaan,

The ticket is still open, so no, we didn’t work on this yet. It’s also currently not planned I’m afraid.


Hi @thorben

Thanks for the response.

I am curious as to any workaround for this you could suggest ?

Also is it possible for users of the enterprise version to be able to request assistance with this bug ?

Zishaan Osman

Hi Zishaan,

I’m sorry I don’t have the time to look into this further. As an enterprise customer you can raise a support ticket and ask for both a bug fix and a workaround. We describe how to do that here: Camunda Enterprise Support Guide |


1 Like