# How to use businessKey in the process expression

**URL:** <https://forum.flowable.org/t/how-to-use-businesskey-in-the-process-expression/11512>\
**Category:** Flowable Engine\
**Created:** [May 13, 2024, 10:11am UTC](https://forum.flowable.org/t/how-to-use-businesskey-in-the-process-expression/11512 "2024-05-13T10:11:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlowBallon](https://avatars.discourse-cdn.com/v4/letter/f/e9bcb4/32.png) [@FlowBallon](https://forum.flowable.org/u/FlowBallon)\
**Post date:** [May 13, 2024, 10:11am UTC](https://forum.flowable.org/t/how-to-use-businesskey-in-the-process-expression/11512/1 "2024-05-13T10:11:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![FlowBallon](https://avatars.discourse-cdn.com/v4/letter/f/e9bcb4/32.png) [@FlowBallon](https://forum.flowable.org/u/FlowBallon)\
**Post date:** [May 13, 2024, 10:13am UTC](https://forum.flowable.org/t/how-to-use-businesskey-in-the-process-expression/11512/2 "2024-05-13T10:13:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![amporsim](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@amporsim](https://forum.flowable.org/u/amporsim)\
**Post date:** [May 13, 2024, 12:30pm UTC](https://forum.flowable.org/t/how-to-use-businesskey-in-the-process-expression/11512/3 "2024-05-13T12:30:22Z")

</div>

Hi @FlowBallon

Flowable Engage ist part of Flowable Enterprise. This forum is for Flowable Open Source. Please use our [Enterprise Forum](https://forum.flowable.com/) for asking questions about Flowable Engage.

Regards,  
Simon

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [May 14, 2024, 6:53am UTC](https://forum.flowable.org/t/how-to-use-businesskey-in-the-process-expression/11512/4 "2024-05-14T06:53:59Z")

</div>

Hi,

it’s a basic functionality supported by expressions

```auto
${execution.businessKey}

```

does the job.

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![FlowBallon](https://avatars.discourse-cdn.com/v4/letter/f/e9bcb4/32.png) [@FlowBallon](https://forum.flowable.org/u/FlowBallon)\
**Post date:** [May 16, 2024, 1:18am UTC](https://forum.flowable.org/t/how-to-use-businesskey-in-the-process-expression/11512/5 "2024-05-16T01:18:51Z")

</div>

execution.businessKey → invalid property error

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [May 17, 2024, 4:37pm UTC](https://forum.flowable.org/t/how-to-use-businesskey-in-the-process-expression/11512/6 "2024-05-17T16:37:51Z")

</div>

```auto
    @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");
    }

```
