cancel
Showing results for 
Search instead for 
Did you mean: 

How to wait for process to reach a user task

kilsen
Champ in-the-making
Champ in-the-making
We have a use case where we're starting an Activiti process within a web app; the actual process that we start might vary depending on what the user has done within our app prior to that point.  After starting the process, we want to allow it to proceed until it reaches a user task, and then we want to get the task and get the form key of the task, so we can redirect to a controller in our app and present the corresponding form to the user.

We believe we're experiencing a race condition . . . sometimes, we're apparently retrieving the task / form key BEFORE the process has reached the user task (i.e., it's still doing the preliminary service tasks that are part of the workflow process, prior to the user task), and so we get a null form key.

Is there a way, via the API, for us to allow the process (which we just started) to proceed until it reaches a user task, and THEN we'd get the task and form key?
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
This is the default behavior:

A->B->C->User task

If A,B,C are service tasks, the thread only returns if A,B and C are done.
I suspect you've made a service task that is before your user task asynchronous? That would explain what you see.

kilsen
Champ in-the-making
Champ in-the-making
Thanks for the reply. We had added some console logging that included the thread id, and realized that the service task (the process only has one initial service task) was operating in the main thread, and was completing up to the first user task, at which time the thread returned to the caller. But we checked our service task and it's definitely not asynchronous. The problem is intermittent and that's why we thought it was a race condition. We'll dig a little deeper. Thanks again for confirming the default behavior.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.