cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie Data Storage Question

mangar
Star Contributor
Star Contributor
I am trying to get task form data (ie  activiti:formKey="jiswf:myForm") and I need this  data later..

I am in an Alfresco environment. And after research, it seems that the form only works for that individual task.

My questions are:

1. if I need to store data across the entire process, what is the best way to do this?
2. How does my task access that data,
3. And most important, what happens to this data once the workflow is over? 

I have a requirement that I need to list the completed workflows. (This is easy enough) but I need to display my form data along with it.   Also I will need  this information for historical and reporting purposes.

Any suggestions?
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
Due to the nature of the Worklow API in Alfresco, variable/propery handling is a bit different than with a plain-old activiti standalone. If you want to have variables that live on the process (not on a task-scope), there are 2 ways of doing this:

1) Define the variables in your start-form. The data that is filled in on the start-form will be pushed as variables which live on the process-scope.
2) Using script or Java-logic, set variables during the process on the execution. This is done in Alfresco default processes using a scriptTaskListener, for example. If you want to have a task set a global variable, use a listener to copy the task.getVariableLocal(…) value into execution.setVariable(…).

Variables that are set on a process-scope can be accessed though scripts/java and can also be exposed in task-forms. General rule is:

A task returns/shows a property if:
- The task model declares it
- The task has a LOCAL variable set, even if it's not declared in the task-model

Property-value will be:
- The value of the task local variable for that property
- If above not available, the process-variable for that property
- If above not available, the 'default' value configured in the task-model
- If above not available, null


So in case you want to display a process-property on a task, you can just add that property on the task-form, and the global variable will be show.

After a workflow is completed, the variables are still present in the history. You can fetch all completed tasks and all properties associated with them as well…

Wow, thank you so much!  That explains it all so well. I could not understand why my variables that I was setting when starting the workflow were showing up in my task form data, but now i do!