Camunda Task Lifecycle question

Hi team,

After upgraded from 7.10.0 to 7.14.0. We found that the following api call to add or remove the user or group from task instance will generate the lifecycle event and trigger the "assigement’ notification on task node.

    TaskService taskService = getProcessEngine().getTaskService();
    String taskId = task.getId();
    // below method call now trigger the "assigement' event now!!
    **taskService.addUserIdentityLink(taskId, newAssignee, CANDIDATE);**
    // below method call now trigger the "assigement' event now!!
    **removeOldUserGroups(taskService, taskId, oldAssignee);**

This was not happened on old version of Camunda 7.10.0. Since we have above code logic inside the notification listener. We got stack overflow exception. Is there any way to disable this behavior?

Hi @Louislu,

You can read about this change in teh migration guide at https://docs.camunda.org/manual/7.14/update/minor/711-to-712/#task-lifecycle-state-and-task-events.

In order to avoid the nested events triggering, you can rewrite your code to use the methods in the DelegateTask interface, such as DelegateTask#addUserIdentityLink. This will not trigger another event, calling the methods in TaskService will.

Cheers,
Thorben

Thanks for the help. It works.