public class DoBadThings implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) {
execution.setVariable("clientName", "Jane Doe");
throw new BPMNError("BAD");
}
}
Should clientName be available for the user task?
If not:
is there documentation explaining this
is there a way to persist across the error boundary event?
If so, we have a project in which the mapping doesn’t seem to be taking place in this scenario and I would be happy to provide further details if needed.
By default, it won’t be available. The reason is that a call activity uses an in/out mapping for it’s variables. So:
Have you tried providing an/in out mapping? (not sure if this works when using a BpmnError).
Otherwise, you can get the parent process instance from your execution, and set the variable on that process instance instead of the one for the called one in the call activity.
Having the same issue. Sub-workflow does not persist an out variable to the parent when Bpmn error is thrown. It does only if sub-workflow is successful (probably because end event is executed). Is there an option to enforce that on the call-activity itself? Or some other clean solution?
He did provide the flowable:out variable for clientName on the call activity.
Otherwise, you can get the parent process instance from your execution, and set the variable on that process instance instead of the one for the called one in the call activity.
This is not ideal either - what if variable is already set on the sub-workflow and unexpected error happens?
Also, if there is a grandparent workflow it won’t be persisted to it either. Application I am working on has multi-level sub-workflows and rely on out variables.