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?