cancel
Showing results for 
Search instead for 
Did you mean: 

TaskListener assignment event

fspampinato
Champ in-the-making
Champ in-the-making
Hi,

I have a question about the order in which TaskListener assignment event it's fired.

The documentation says:

<blockquote><b>assignment</b>: occurs when the task is assigned to somebody. Note: when process execution arrives in a userTask, first an assignment event will be fired, before the create event is fired. This might seem an unnatural order, but the reason is pragmatic: when receiving the create event, we usually want to inspect all properties of the task including the assignee.</blockquote>

I've written a small test case and it seems that the order in which the events are fired is:

- <b>create</b>
- <b>assignment</b>
- <b>complete</b>

I've attached my test case.

What is the correct order of user task events?

Thanks, Francesco.
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
Is this on Activiti 5 or 6? Cause i'm pretty sure on v5 it's as in the docs.

fspampinato
Champ in-the-making
Champ in-the-making
Activiti 5.19

maudrid
Champ on-the-rise
Champ on-the-rise
I can confirm that in activiti 6 the following is true:

If your user task in a process does not have the 'Assignments' property set to anything:
- create
- assignment
- complete
- delete (even if you just complete the task)

If your user task in a process does have the 'Assignments' property set:
- assignment
- create
- complete
- delete (even if you just complete the task)

Calling the assignment before create caused an issue for us, so we had to do a work-around.
We also had to work around the delete. If the task/process is cancelled we consider it a delete.
We now check if the task is completed when the delete fires, then we consider it as complete.

jbarrez
Star Contributor
Star Contributor
@maudrid: I checked it in the code … but I can't see how that can happen. Do you have an example that I can use to reproduce the difference in events order being thrown.