cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti Process vs Form variables.

mangar
Star Contributor
Star Contributor
At thew end of the day, I need to set some variables that are available throughout the workflow, and I need it once the workflow is over. I think I have horribly confused myself with process and form variables.  I have a user task like this: (works fine)

 
       <userTask id="usertask1" name="Proposed Order"  activiti:formKey="jiswf:proposedOrders">


However I am setting the vars like this:


              // start workflow with vars
           Map<QName, Serializable> vars = new HashMap<QName, Serializable>();
           vars.put(QName.createQName(AlfrescoModel.WORKFLOW_NAMESPACE,"toName"), stringArray);
                … others
          workflowService.startWorkflow(wfDefinition.getId(), vars);


What am I doing here?  From the documentation, that looks like I am setting process variables. But when I access the task through the workflow helper like this:

task.getProperties().get(QName.createQName(AlfrescoModel.WORKFLOW_NAMESPACE,"toName"));


That works fine, but should it?

How do I set variables that are set throughout the workflow, and more importantly, How do  I get access to those variables thought the WorkflowService after the workflow is complete?
1 REPLY 1

mitpatoliya
Star Collaborator
Star Collaborator
The only thing you need to take care is variables you are setting during start workflow are workflow variables and during getting those variables you are retrieving it from task.
Task variables and workflow variables are different so you could be confused later on.