How to detect the event for Human Task "activated"
I need to create 3 event handlers, triggered when one human task :
- is activated (or initialized)
- When it's assigned to a user
- When it's completed (with errors or not)
I'm able to get the third done using the state "completed" of flowNodeInstance.getStateName()
For the first one the status ready is not good because a Human task is ready also after execution, so my event is triggered twice.
I didn't find this information in the documentation, any help is appreciated,
The 3 events are different and do not overlap:
- is activated (or initialized) => User task is in READY state and assigneeId = 0
- When it's assigned to a user => User task is in READY state and assigneeId != 0
- When it's completed (with errors or not) => User task is in COMPLETED
You should register all those 3 events on FLOWNODE_INSTANCE_UPDATED event, and then check for the conditions above.
This can be done in 3 event handlers, or all in the same event handler.
Hope this helps.
That what I thing. Check the event.getType() (unfortunately, this is a String and not an enum) : they must be different, and you should have different values.
Could you join the event handler and the list of events you register on?
I don't get your comment "Human task is ready also after execution, so my event is triggered twice."
Normally, a task is READY when connectors "IN" are finished, then the task is visible for a user. What do you mean by "also after execution"? Did you get a READY event when the last connector "OUT" is executed? Or when the user clicks on the SUBMIT button?
By the way, if for an event, you get an event TWICE (except the Assign/ Unassign event), then you can open a ticket on the support
Note: for the second event, do you have a way to determine this is the second event? Something changes in the task of do you just received the call twice, immediately?
Yes, the event is executed twice, once when the task gets available, and the other one when it's executed.
From the documentation:
it's written "Catch FLOWNODE_INSTANCE_CREATED to detect that a human task is available" anyone knows an exemple on how to do that?