How to detect the event for Human Task "activated"

1
0
-1

Hello,

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,

kind regards,

Enrico

3 answers

1
+1
-1
This one is the BEST answer!

Hi Enrico,

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.

Comments

Submitted by Pierre-yves Monnet on Thu, 10/22/2020 - 17:19

Hello,

+1

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.

1
0
-1

In most cases, a job is considered to be "READY" if all of the connectors "IN" have been completed; at this point, the work becomes visible to the user. To clarify, what do you mean when you say "also after execution"? Have you received a READY event after the execution of the last connector's "OUT" command? Or when the user submits the form by clicking the button labeled "SUBMIT"?

https://documentation.bonitasoft.com/bonita/7.11/event-handlers

If, during the course of an event, you receive the same event TWICE (with the exception of the Assign/Unassign event), then you can submit a request for assistance using the support portal.

1
0
-1

Hello Enrico,

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?

Best,

Comments

Submitted by enrico.curiotto on Thu, 10/22/2020 - 09:00

Yes, the event is executed twice, once when the task gets available, and the other one when it's executed.

From the documentation:

https://documentation.bonitasoft.com/bonita/7.11/event-handlers

it's written "Catch FLOWNODE_INSTANCE_CREATED to detect that a human task is available" anyone knows an exemple on how to do that?

Notifications