I created a simple workflow where I am calling an event subprocess in another process using a service task and I am doing this by using a Java code. I configured the java class in the service task using the Implementation type “Delegate Expression” (see below)
I get the following error while running the service task.
An error happened while submitting the task form : Cannot submit task form 54897af5-dc6b-11ec-85f0-e02be903a6c0: Unknown property used in expression: #{cancelProcess}. Cause: Cannot resolve identifier ‘cancelProcess’
Here is my Java code :
package org.example;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
@Component("cancelProcess")
public class CancelProcess implements JavaDelegate {
public void execute(DelegateExecution execution) {
// correlate the message
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
MessageCorrelationResult result = runtimeService.createMessageCorrelation("CANCEL_PROCESS")
.processInstanceBusinessKey("Order-Process-123")
.setVariable("employeeName", execution.getVariable("employeeName"))
.correlateWithResult();
}
}
Please advise. What mistake am I making here.