How to use businessKey in the process expression

flowable-engage-external-system-whatsapp-3.13.10.jar

WhatsAppSenderMessageListener.class

ProcessInstanceBuilder timeoutProcessInstanceBuilder = this.runtimeService.createProcessInstanceBuilder().businessKey(userAccount.getId()).variable(“clientConversationId”, conversation.getId()).variable(“clientUserId”, userId).processDefinitionKey(this.whatsAppProperties.getTimeout().getProcessDefinitionKey());
if (StringUtils.isNotEmpty(userAccount.getTenantId())) {
timeoutProcessInstanceBuilder.tenantId(userAccount.getTenantId());
}
====>
I want to use the businessKey in the process expression. How to get it? ${root.businessKey} is not working.

I tried this but it doesn’t work:
expression=“#{conversationService.setVariable(clientConversationId, ${root.businessKey}, 5”)

Hi @FlowBallon

Flowable Engage ist part of Flowable Enterprise. This forum is for Flowable Open Source. Please use our Enterprise Forum for asking questions about Flowable Engage.

Regards,
Simon

Hi,

it’s a basic functionality supported by expressions

${execution.businessKey}

does the job.

Regards
Martin

execution.businessKey → invalid property error

    @Test
    @Deployment(resources = "org/flowable/engine/test/api/runtime/oneTaskProcess.bpmn20.xml")
    public void executionBusinessKeyExpression() {
        ProcessInstance processInstance = runtimeService.createProcessInstanceBuilder()
                .businessKey("testBusinessKey")
                .processDefinitionKey("oneTaskProcess")
                .start();

        Expression expression = this.processEngineConfiguration.getExpressionManager().createExpression("${execution.businessKey}");
        Object value = managementService.executeCommand(commandContext ->
                expression.getValue((ExecutionEntity) runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).includeProcessVariables().singleResult()));

        assertThat(value).isEqualTo("testBusinessKey");
    }