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…