CMMN processTask: use expression for dynamic resolution

I have a cmmn diagram that contains a process-task.

Which concrete process is started (processDefinitionKey/latest) should by evaluated dynamically (different variants of same process).

The modeller allows me to select “expression” so I implemented a bean (spring) that takes the DelegateCaseExection and returns a String (the processDefinitionKey).

However, when I run a test (processEngineRule, h2, mocks.register) I get:

[main] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: no processes deployed with key 'null' and tenant-id 'null': processDefinition is null

org.camunda.bpm.engine.exception.NullValueException: no processes deployed with key ‘null’ and tenant-id ‘null’: processDefinition is null

I put a breakpoint in my bean, but is not even called. Seems like the “expression” selector is useless for processTasks in CMMN.
Or am I doing something wrong here?

Thanks
Jan

OK, I figured this out myself … you must not choose “reference”, you stick with “reference” but still provide an expression that returns a processDefinitionKey.

Self explanatory.