Set the task variable in a BPMN model

I would like to flag certain tasks during modeling to filter on that. For example certain tasks are “important”.

There seems to be a concept of task variable and I can do something like that:

engine.getTaskService().createTaskQuery().taskVariableValueEquals("important", "true");

My question is, where is the place to set this task variable in the BPMN model? I tried these inside the userTask but none of them seem to set the task variable.

	<camunda:property name="important" value="true" />

 	<camunda:inputParameter name="important">true</camunda:inputParameter>

<camunda:taskListener expression="${execution.setVariableLocal(&#34;important&#34;, &#34;true&#34;)}" event="create" />

<camunda:taskListener expression="${execution.setVariable(&#34;important&#34;, &#34;true&#34;)}" event="create" />

Hi @f_a,

Please try the following:

<camunda:taskListener expression="${task.setVariableLocal(&#34;important&#34;,&#34;true&#34;)}" event="create" />

The difference is that you are using execution but you need to use task scope.

Best regards,

1 Like

Works! Thanks a lot Yana.