cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically call subprocess?

oconnor0
Champ in-the-making
Champ in-the-making
Is there a way or an example of how to dynamically specify which subprocess to call? I started looking at this via using a Java service call (via extending AbstractBpmnActivityBehavior) to delegate to a subprocess but was unable to figure it out.
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
You can use an expression in the call-activity for the "calledElement" attribute, see the DefaultActivityBehaviourFactory implementations which supports using an expression:


public CallActivityBehavior createCallActivityBehavior(CallActivity callActivity) {
    String expressionRegex = "\\$+\\{+.+\\}";
   
    CallActivityBehavior callActivityBehaviour = null;
    if (StringUtils.isNotEmpty(callActivity.getCalledElement()) && callActivity.getCalledElement().matches(expressionRegex)) {
      callActivityBehaviour = new CallActivityBehavior(expressionManager.createExpression(callActivity.getCalledElement()));
    } else {
      callActivityBehaviour = new CallActivityBehavior(callActivity.getCalledElement());
    }

oconnor0
Champ in-the-making
Champ in-the-making
Thanks, that works great.