[Flowable newbie]
Hi.
We are currently building an automated workflow on top of an existing ERP system.
The requirements are relatively simple:
- Every time a User Task gets instantiated as part of a process execution, an equivalent (and linked) Task ‘object’ is created in the ERP.
- Point 1 should be totally transparent to BPMN process authors.
I managed to make it work.
I’m implementing the FlowableEventListener
interface and filtering on the TASK_CREATED
event type in the onEvent
method.
However, when replicating the ERP Task (from the User Task) I need to fetch process instance level variables. I do that by calling getProcessVariables()
which consistently yields nothing.
@Override
public void onEvent(FlowableEvent ev) {
if ((FlowableEngineEventType) ev.getType() == FlowableEngineEventType.TASK_CREATED) {
FlowableEngineEntityEvent event = (FlowableEngineEntityEvent) ev;
Task task = (Task) event.getEntity();
Map vars = task.getProcessVariables();
// vars is empty .. where are my variables :-(
}
}
What am I doing wrong? Do I, instead, have to use runtimeService
to re-query for process instance level variables?
Many thanks.