cancel
Showing results for 
Search instead for 
Did you mean: 

'Process Instance Variable' and 'Task Local Variable'

lojian
Champ in-the-making
Champ in-the-making
Does anyone how the differences between "Process Instance Variable" and "Task Local Variable"?
8 REPLIES 8

frederikherema1
Star Contributor
Star Contributor
Task variables are only available within the task itself. Once the task is complete, they are gone (although present in history if configured to historyLevel FULL).

Setting process variables from API:

runtimeService.setVariable(processInstance.getId(), "varName", "value");

Setting task variables from API:

taskService.setVariableLocal(task.getId(), "varName", "value");

lojian
Champ in-the-making
Champ in-the-making
Got it! Thanks a lot!

I suggest write these concept into documentation. 🙂 Maybe I could help.

pgrec
Champ in-the-making
Champ in-the-making
Hi. Are Local variables accessible in Forms (e.g. as temporary variable which will be created on create task, or processed on exit task )? I miss this feature.

jbarrez
Star Contributor
Star Contributor
You should take a look at 'form properties', that's exactly what you probably need http://activiti.org/userguide/index.html#formProperties

jorell
Champ in-the-making
Champ in-the-making
How would we specify task local variables in the bpmn? I read somewhere else on this forum that io specs are not supported, is that true?

frederikherema1
Star Contributor
Star Contributor
If you want task-local variables, use a taskListener (create) to get access to the DelegateTask, which supports setVariableLocal()…

How do I get ProcessInstance Variable in expression

tgebeyehu
Champ in-the-making
Champ in-the-making
${myVar}