AnsweredAssumed Answered

Set calledElement using expression at runtime with Multi Instance Loop

Question asked by sunshare on Mar 1, 2016
Latest reply on Mar 2, 2016 by sunshare
Hey,

I am having a issue with setting the calledElement at runtime for CallActivity with MultiInstanceLoopCharacteristics. This is how I created my CallActivity.


        CallActivity callActivity = new CallActivity();
        callActivity.setId(callAcitityId);
        callActivity.setName(callAcitityId);
        callActivity.setCalledElement("${processToCall}");

        IOParameter ioRowParameter = new IOParameter();
        ioRowParameter.setSource("row");
        ioRowParameter.setTarget("row");

        //This is my thought, that if we can pass in the processToCall from the MultiInstanceLoopCharacteristics or from the parent process. Then, it can resolve my calledElement expression ${processToCall}
        IOParameter ioProcessKeyParameter = new IOParameter();
        ioProcessKeyParameter.setSource("processToCall");
        ioProcessKeyParameter.setTarget("processToCall");

        callActivity.setInParameters(Arrays.asList(ioRowParameter));

        MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = new MultiInstanceLoopCharacteristics();
        multiInstanceLoopCharacteristics.setSequential(false);
        multiInstanceLoopCharacteristics.setInputDataItem("rows");
        multiInstanceLoopCharacteristics.setElementVariable("row");

        callActivity.setLoopCharacteristics(multiInstanceLoopCharacteristics);

        return callActivity;


My problem is MultiInstanceLoopCharacteristics only supports collection data, which I used for my data rows. How can I pass in the processToCall into my CallActivity instance to resolve my calledElement at runtime?

Let me know if you need more detail or anything is unclear. Thanks,
Lesong

Outcomes