AnsweredAssumed Answered

Element Variable not being assigned to subprocess for MultiInstanceLoop

Question asked by jorell on Feb 6, 2014
Latest reply on Feb 13, 2014 by jorell
I seem to be having a very basic problem. I have the following node in a parent process:


<callActivity id="createSubs" name="CreatSubs" activiti:exclusive="false" calledElement="multiInstanceLoopSub">
      <extensionElements>
        <activiti:in source="line_item_id" target="l_i_id"/>
        <activiti:out source="o_id" target="order_id"/>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="c_ids" activiti:elementVariable="creative_id"/>
    </callActivity>


I set c_ids to be an ArrayList having values a,b,c. I have a custom type for list and that is the type of the variable 'c_ids'. I do see three subprocesses instantiated but none of them have a creative_id variable. When I look in the db I see this:

select * from ACT_RU_VARIABLE where NAME_='creative_id';

+——-+——+——–+————-+—————+—————+———-+—————+———+——-+——-+——–+
| ID_   | REV_ | TYPE_  | NAME_       | EXECUTION_ID_ | PROC_INST_ID_ | TASK_ID_ | BYTEARRAY_ID_ | DOUBLE_ | LONG_ | TEXT_ | TEXT2_ |
+——-+——+——–+————-+—————+—————+———-+—————+———+——-+——-+——–+
| 10087 |    1 | string | creative_id | 10083         | 10072         | NULL     | NULL          |    NULL |  NULL | a     | NULL   |
| 10093 |    1 | string | creative_id | 10084         | 10072         | NULL     | NULL          |    NULL |  NULL | b     | NULL   |
| 10100 |    1 | string | creative_id | 10085         | 10072         | NULL     | NULL          |    NULL |  NULL | c     | NULL   |


Now 10072 is the process id of the PARENT process not the sub process (which in this case is 10088). In the sub process in the first task I have a delegate and in that delegate execution.hasVariable("creative_id") returns null. So I'm confused why the variables were created in the parent process and not in the child process. And how I am supposed to accessing them in the subprocess delegate without traversing the execution chain to the parent.

Outcomes