AnsweredAssumed Answered

Invoke User task from Custom Event listener

Question asked by bala1010 on Jul 18, 2016
Hi,

We have a process in which custom event should be used to get the data from user. We have tried to design process in two ways.

1) service task -> business rule task -> service task  (task in which custom event will be dispatched) -> user task -> service task (to save user data)

There is a listener for custom event which will query for user task and find the form key to get user input. The task query returns always null
because the current transaction is not flushed into database yet. From the understanding from user guide, transaction will be flushed only when the process reaches
the wait state (user task or async task). But I can't keep the service task as async because my service which started the process is waiting for form key to return as response.

So for this limitation, we have designed it as two processes

2) i) process 1 => service task -> business rule task -> service task  (task in which custom event will be dispatched) -> end
               ii) process 2 => start -> user task -> service task (to save user data) -> end
              
               Custom event listener will start the process 2 and query the user task from second process. Task query returns null even though second process reaches wait state(user task). 
               Observed in db that both the process executions are not persisted.
              
So please confirm is there any other way to invoke user task from custom event listener or is it an invalid case
where we can’t fetch user task properties in event listener ?

I have attached the BPMN files as text file with this topic as kitprocess [Main BPMN] and kitsubprocess .

Outcomes