Hello Everyone, new user here trying to get up to speed on using the process engine within a java application. I have a simple model with a couple of user tasks. I am able to create an instance of the model programmatically with
ProcessInstance pInstance = runtime.createProcessInstanceByKey(“pto-request”)
.businessKey(“pto-request-test1”)
.execute();
However when I try to complete the first user task, I receive an Exception while closing command context: Unknown property used in expression: ${ptoStatus == ‘accepted’}. Cause: Cannot resolve identifier ‘ptoStatus’. This process variable is defined as a conditional expression later in the flow – unreachable from the first user task.
I was able to deploy this model to the BPMN Run container, and then use Cockpit and Task List to create an instance of the process and complete the first user task without defining the “ptoStatus” variable, The goal is to create that variable when the second user task is completed. Here is the code being used to complete the first user task
Task specifyHoursTask = tasks.createTaskQuery()
.processInstanceId(pInstance.getId())
.taskDefinitionKey(“specify-hours”)
.singleResult();
tasks.setVariable(specifyHoursTask.getId(), “ptoHours”, 4);
tasks.complete(specifyHoursTask.getId());
Any suggestions would be greatly appreciated, thank you in advance.