cancel
Showing results for 
Search instead for 
Did you mean: 

getBusinessKey() on DelegateExecution returns null

mesterlis
Champ in-the-making
Champ in-the-making
Since Activiti 5.6, it's possible to retrieve business key from DelegateExecution in JavaDelegate task, which is great! It works in most cases. However, I came across a case where delegateExecution.getBusinessKey() returns null.

I have the following definition:

<parallelGateway id="fork" />
<sequenceFlow id="flow140" sourceRef="fork" targetRef="meetingUserTask" />
<sequenceFlow id="flow150" sourceRef="fork" targetRef="meetingDelegateTask" />

meetingUserTask refers to a user task and meetingDelegateTask refers to a JavaDelegate task.

When I try to retrieve the business key from meetingDelegateTask, I get null back.

It seems like a bug, but maybe there is a work around for it.

Your help is greatly appreciated.
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
I see what the problem is… We have 2 DelegateExecution implementing classes. The ExecutionEntity returns it's own business-key member field, while the ExecutionImpl returns the businesskey retrieved from the processInstance.

I'll reopen the issue http://jira.codehaus.org/browse/ACT-730 and fix it in 5.7 release. Since the getBusinessKey() is used in persistence, having the ExecutionEntity return the process-instance's businesskey on getBusinessKey() is not an option, it will probabily be called getProcessBusinessKey().

mesterlis
Champ in-the-making
Champ in-the-making
Thanks for the quick reply and for the fix in 5.7!

In the meantime to work around the issue, I am going to cheat by casting delegateExecution to ExecutionEntity:
((ExecutionEntity)delegateExecution).getProcessInstance().getBusinessKey();

yerbol777
Champ in-the-making
Champ in-the-making
Hi,
I am trying to get ProcessBusinesskey on startEvent of Process by ExecutionListener, but it is returning null.
None of them works:
execution.getProcessBusinessKey()
execution.getBusinessKey()

Pls, can you suggest method to do it?