cancel
Showing results for 
Search instead for 
Did you mean: 

Get formKey for completed user task

sukhveer
Champ in-the-making
Champ in-the-making
Hi,
I am using activiti as embedded engine in Struts2 application. It is very cool and am loving it. But unfortunately i am stuck at some point.
i am using formKey for all my user tasks and then setting my action URL by getting formKey using formService as :
     setUrl(formService.getTaskFormData(taskId).getFormKey());
this way i am able to display different jsp for each view.
But i cannot use the method above for a task that is completed. For some reasons we need to display history complete/rejected tasks.
Is there any way that i can get formKey for a completed task?
Any help will be appreciated.

Thanks & regards,
Suk
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
Indeed, the form key is gone when it goes into history (why would you want to display a form for a task that is completed…)

The easiest workaround I can think of, is to add a task listener that listens to the task creation event, and copies the formkey to a process variable. Process variables are stored in the history database.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Indeed, the form key is gone when it goes into history (why would you want to display a form for a task that is completed…)

Well, that is easy to answer… In a process you could be starting to build a 'dossier/file' consisting of separate xml messages (yes, the form key is a reference to an xform in our case). You have a 'dossier' view there that consists of references to each individual message. Now it is not clearly unthinkable that one of these messages needs to be viewed by others. Runtime that is possible since the task is still there. But when a question comes in later after the instance has finished…. Well….

Currently we store a reference to the task AND the formkey in our dossier to be able to view the message again afterwards…

jbarrez
Star Contributor
Star Contributor
@Ronald: yes, see your point. Indeed that happens of course when you build case mgmt on top of Activiti.

Would adding the formKey to the history be easier (I assume yes)? If you file a Jira, I'll implement it 😉

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
I will…

sukhveer
Champ in-the-making
Champ in-the-making
Thanks guys.
Actually we are using it in case management scenario where we need to keep track for history tasks and also able to view them if required.
For this moment i will add process variable for formKey, and wait for the implementation for history.

Thanks again,
Suk