Hi,
I want to run a BPMN process (“MAIN_PROCESS”) containing a CallActivity.
The calledElement attribute of the CallAcitivity has to be set dynamically during runtime.
So I use a property variable
<bpmn:callActivity id=“Task_046r1k4” calledElement="${processTobeExecuted}">
This variable is filled via an automated task into the context before the CallActivity is executed.
DelegateExecution execution
execution.setVariable(“processTobeExecuted”, “Process_A”);
Using Activiti BPM engine, the process runs as expected. After I migrated to Camunda BPM, I get an error when I start the main-process via Java API
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(“MAIN_PROCESS”);
The error says:
org.camunda.bpm.engine.ProcessEngineException: Unknown property used in expression: ${processTobeExecuted}. Cause: Cannot resolve identifier ‘processTobeExecuted’
So the question is: Do I have to specify the variable processTobeExecuted before I start the main-process? How can I achieve this?
Thanks and best regards
Roland
StackTrace.txt (18.7 KB)
@Roland can you confirm in the cockpit that your process variable “processTobeExecuted” is being created?
Hi StephenOTT
so far I didn’t use the cockpit.
So far I used the modeller to create the BPMN file. Afterwards I stored the BPMN file into a Java project in an Eclipse workspace. And there I started the process (using Spring Boot)
As said, the same procedure worked with Activiti BPM.
BTW: Is the cockpit an additional software that I have to install? How would I check this using the cockpit?
Cheers Roland
@Roland here is a working example of a dynamic Call Activity based on a process variable:
use_case_sub_process_dynamic_call.bpmn (7.3 KB)
1 Like
Hi StephenOTT
thank you very much. I opened it in the modeller. The only difference that I can see comparing to my process is that you execute an automated task where you call a Javascript routine that sets the context variable (execution.setVariable(‘subProcessName’,‘secondary’);
In my process I execute a Java classe that does the same (because i want to read the processes to be executed from a database table).
Strange, I expected that both variants (JS and Java class) would have the same behaviour.
heers, RolandMAIN_PROCESS.bpmn.txt (10.0 KB)
Hi
I solved the problem. Thank you StephenOTT, you pointed me to the right direction.
After I saw how you managed to define the variable using the Script Task I had a closer look into my Automated Task where I execute a Java delegate. This delegate class sets the context variable, but it was never executed. The reason was a misconfiguration. Under AutomatedTask/General/details I have chosen “Delegate” in the “implementation” dropdown menu. After changing this to “Delegate Expression” everything works fine now
(see screenshot). The Delegate is now executed and the context variable is set correctly.
Thanks and best regards
Roland