Why can't I access an Element Variable using getVariableLocal in a listener of a multi-instance task?

Sorry for my bad english.
I have a process with a multi-instance user task with a “Create” task listener , and set Element Variable to “item”.
I can’t access Variable by java method “delegateTask.getVariableLocal(“item”)” but method “getVariable(“item”)” works. I don’t understand. I think the Element Variable should be a local variable but it looks like a variable in process instance scope?

Hi @WinterG26,

item is created as an activity instance scoped variable (neither a task instance scoped variable, nor a process instance scoped variable).
delegateTask.getVariableLocal(“item”) returns task instance scoped variable named item which doesn’t exist in this case.

delegateTask.getVariable(“item”) returns the nearest visible variable named item which is the activity instance scoped variable

1 Like

Thanks for your help Hassang. It’s clear to understand.

1 Like