Variables set in process builder can't be seen by delegates

Hi,

When I start a process like this:

Map<String, Object> processVariables = new HashMap<>();
processVariables.put("hello", "World");
ProcessInstance processInstance = runtimeService.createProcessInstanceBuilder().
        processDefinitionKey(processKey).variables(processVariables).businessKey(transactionId).start();

and try to read the variable inside a JavaDelegate belonging to the flow:

log.debug("Hello {}", (String) execution.getVariable("hello"));

I get null. Why? Bonus question: why the business key is also null?

Cheers
Radek

Hey @rajish,

This should work.

Can you please share your BPMN XML?

Cheers,
Filip

Hi @filiphr,

Unfortunately, I can’t share the XMLs as they contain a proprietary business flow. All I can say they consist of three levels of sub-flows and at one point there’s a text annotation like IN: hello. In that case, the variable can be seen by the delegate with that annotation with proper value, while other variables passed in the same map are null.

I was able to do some debugging and found out that in this line the execution parent contains only the annotated variable while all other variables exist in commandContext.command.variables but they’re not passed to the delegate.

Is it possible that it’s a bug in the Flowable Engine?

Regards
Radek

is this issue Still open ?