cancel
Showing results for 
Search instead for 
Did you mean: 

UserTask completion and forms: Middle point needed

gwaptiva
Champ in-the-making
Champ in-the-making
Hi, I'm trying to "break into" the Activiti flow in between the moment a user completes a user task, and the moment that user task's form is displayed.

(Activiti 5.7 embedded into our application).

At one point in our process, a usertask is assigned to a user, and user is given a number of days to do work in the system and then to complete the usertask. As the user completes the usertask, a form will be displayed asking user to confirm that she really has completed the task.

Now, the issue is that between the assignment of the usertask and the completion of the usertask the execution's context isn't updated; it just stays in the database. This will lead to the form displaying data that is stale/incorrect.

I thought about a TaskListener, but "create" and "assignment" are called at the time the task is first issued (possibly months before), and the form appears to be rendered before the "complete" trigger is executed.

Do I really have to implement my own FormEngine to be able to refresh the context against which the FormEngine evaluates the form?

Thanks for any hints
1 REPLY 1

gwaptiva
Champ in-the-making
Champ in-the-making
Ok, apologies, seems I posted too hastily.

Digging into the Activiti code, I found that UserTask supports an undocumented attribute activiti:formHandlerClass which expects the fully qualified name of a Java class implementing the TaskFormHandler interface.

So, I subclassed DefaultTaskFormHandler and overrode #createTaskForm(TaskEntity) to do what I want it to (go to database, manipulate execution context, etc). From here, I suppose I could also handle the i18n stuff.