I am new, so I might be misunderstanding something.
I want to start a process via REST with variables. I haven’t found a complete example. My process that contains this startEvent:
<bpmn:startEvent id="StartEvent_1" camunda:formKey="variables">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="project" type="string" defaultValue="project" />
<camunda:formField id="boo" type="string" defaultValue="boo" />
</camunda:formData>
</bpmn:extensionElements>
<bpmn:outgoing>Flow_11sed7i</bpmn:outgoing>
</bpmn:startEvent>
My rest call looks like this
const payload = {
variables: {
project: { value: 'Example', type: 'String' },
boo: { value: 'Testing', type: 'String' }
}
};
await axios({
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(payload),
url: "http://localhost:8080/engine-rest/process-definition/key/my-test/submit-form",
});
This starts up the process, but then my process calls a remote Java Worker and in the remote Java worker I try to get the variable (code below), the variables are both at the defaultValue
value.
client.subscribe("mytest").handler((task, taskService) -> {
System.out.println("1: " + task.getVariable("project"));
System.out.println("2: " + task.getVariable("boo"));
...
taskService.complete(task, variables);
}).open();
What am I doing wrong? Is there an example with both the bpmn and the calling code?
Thank you!