cancel
Showing results for 
Search instead for 
Did you mean: 

Set task level variables without writing code.

ssun
Champ on-the-rise
Champ on-the-rise
In my workflow, I have user tasks with form variables. When user try to complete a task, they have to enter the values to complete the task. After that the variables becomes variables of the process.

In my workflow, I have call activity that start sub process. I have input and out put parameters. Input becomes the process variable of the sub process when sub process starts. Output becomes the process variable of parent process when the sub process ends.

These are built in and so easy to use. Thanks guys!

But when I create multiple parallel tasks in on process, I cannot figure out how to have task level variables/results. For example, I have a task to create order to cover demand. After created, I use a inclusive gateway, one flow is for the created purchase order to go to wait for fulfill status, another flow is if the demand is not completely covered, it goes back to create order to create more. But after the user created another order, they enter the second order id to complete the task, I lost the order id for the first order because the form property "orderId" is process level variable.

I wonder how I can have the form value user put saved to task level variable. Or how can I have the "wait for fulfill" task copy down the "orderId" from the process level to the task level so when user create another order, the new order id does not overwrite it.

Thank you very much!

–Gordon
5 REPLIES 5

ssun
Champ on-the-rise
Champ on-the-rise
One quick solution I would try is to use a call activity and create a sub process instead of a task for the "wait for fulfill".
In that case, I can use the built in input and output parameter to preserve the order id.
But I wonder if this is abuse of call activity.

–Gordon

ssun
Champ on-the-rise
Champ on-the-rise
Can anyone tell me if Activiti can set task level variables for next task? (Without writing code that copies down the process level variable to task level at the beginning of the task)

Thank you very much!

ssun
Champ on-the-rise
Champ on-the-rise
Can anyone give me a simple yes/no? Not proposing new feature here but wonder if I should stop looking and start writing code or not.

sathish1
Champ in-the-making
Champ in-the-making
I was not able to pass the variables between forms and tasks ., for example there are two user tasks and the form variables in both tasks were defined as something as like this

<code>
  <extensionElements>
        <activiti:formProperty id="firstname" name="firstname" type="string" variable="$firstname"></activiti:formProperty>
</extensionElements>
</code>


In order to access the form variables were , this following piece of line of code was helpful.,

<code>
Object map = activitiSpringRule.getFormService().getTaskFormData(task.getId());
….

taskFormFirstName = ((FormPropertyImpl) ((TaskFormDataImpl) pvMap).getFormProperties().get(0)).getValue();
</code>

cheers,

ssun
Champ on-the-rise
Champ on-the-rise
Thank you sathish. So it seems that this is not possible without code.