Assign task with a reason and a comment

We are currently creating a java application that uses Camunda for the Workflow in the Background. When assigning a task to a specific user, we want to be able to add a reason why this has been done, together with a comment that can explain that further. How can something like this be achieved in Camunda?

@Kasim_Bajramovic You can use the api /task/{id}/comment (Subresource) and then call the api of /task/{id}/assignee.

Hi @Kasim_Bajramovic,

additionally to @Vishwajeet_Kumar 's comment you can use task local variables for comment and reason. In a task listener you can write:

delegateTask.setVariableLocal("reason", reasonWhy);

Hope this helps, Ingo

Hi, and thank you for the fast answers. That’s actually what I’m doing right now, and the reason I’m not quite happy about that is that there is no id that connects all those parts with each other, so if you do multiple assignments within a task (and this is totally possible) than you need to rely on the timestamp of each of the parts. Because neither the comment not the local variable are connected with assignment or the identity link table. You are commenting or creating a variable on the task and not on the assignment.

Kind regards