// get the task using the task Id
Task task = taskService.createTaskQuery().taskId(“your_task_id”).singleResult();
// get the execution using the execution Id
Execution execution = runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult();
execution.getVariable(“formArg”);
Below is my CMMN model with humanTask having inputParameter. I have process variable called “formArg” and it has value. but execution.getVariable(“payload”) is returning null. What can be issue?
Hi Arvind
TaskCreationListener attached to humanTask has access to DelegateCaseExecution
and I use delegateCaseExecution.getVariableLocal(“payload”). This returns null.
I was thinking “payload” inputParameter variable should have value assigned from ${formArg}.
I tried using formService that you mentioned but we use external forms and that really doesn’t fit and doesn’t work for me.
What I meant is I don’t get value of “x” variable in TaskCreationListener using execution.getVariable(“x”) for this input -
<camunda:inputParameter name=“x”>foo</camunda:inputParameter>
I still did not get value of InputParameter in TaskListener class . Here is my cmmn snippet -
<cmmn:humanTask name=“Provide Customer Rating” id=“HumanTask_2” camunda:assignee=“demo”> cmmn:extensionElements camunda:inputOutput
<camunda:inputParameter name=“x”>6</camunda:inputParameter>
<camunda:outputParameter name=“outcome” />
</camunda:inputOutput>
</cmmn:humanTask>
Here is my TaskListener implements TaskListener {
public void notify(DelegateTask delegateTask) {
DelegateCaseExecution execution = delegateTask.getCaseExecution();
String payload = (String) execution.getVariable(“x”); // returns null
payload = (String) execution.getVariableLocal(“x”); // returns null too.
}
}
Hi @kyle
I’m still not able to get inputParameter value in TaskListener (task create event). I can not use JavaDelegate as this is humanTask and not serviceTask. What am I doing wrong ?
Here is my cmmn snippet -
<cmmn:humanTask name=“Rating” id=“HT_2” camunda:assignee=“demo”>
.cmmn:extensionElements
.camunda:inputOutput
<camunda:inputParameter name=“x”>6</camunda:inputParameter>
</camunda:inputOutput>
</cmmn:extensionElements>
</cmmn:humanTask>
Here is my TaskListener implements TaskListener {
public void notify(DelegateTask delegateTask) {
DelegateCaseExecution execution = delegateTask.getCaseExecution();
String x = (String) execution.getVariable(“x”); // returns null
x = (String) execution.getVariableLocal(“x”); // returns null too.
x = runtimeService.getVariablesLocal(task.getExecutionId()); // throws error //execution does not exist
}
}
hi @Suhas_Kulkarni, I’m still newbie with CMMN, but is it possible to define inputParameter inside Human Task? Apparently camunda modeler doesn’t has this option