AnsweredAssumed Answered

how to set a variable in startevent?

Question asked by miraclesuki on Jun 15, 2015
Latest reply on Jun 16, 2015 by jbarrez
I want to get the property value "mcwf:status" from the model in startevent. Then I need to pass the value of "mcwf:status" to other forms.

Below is the code, it does not printout the variable, it seems that the part of extensionElemnts has not been run?

The snippet of the bpmn diagram:
<blockcode>
<startEvent id="startevent1" name="Start" activiti:formKey="mcwf:submitReviewTask">
    <extensionElements>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
                        var newstatus = task.getVariableLocal('mcwf_status');
                        execution.setVariable('mcwf_newstatus', newstatus);
                        logger.log("AAAAAAAAA      " + newstatus);
                    ]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </startEvent>
</blockcode>
The snippet of the model file:
<blockcode>
<aspect name="mcwf:status">
            <title>Status</title>
            <properties>
                <property name="mcwf:status">
                    <title>Status</title>
                    <type>d:text</type>
                    <default>0</default>
                    <constraints>
                        <constraint type="LIST">
                          <parameter name="allowedValues">
                            <list>
                            <value>100</value>
                            <value>200</value>
                            </list>
                          </parameter>
                        </constraint>
                    </constraints>
                </property>
            </properties>
        </aspect>
</blockcode>
If I change the startevent to usertask, then I copy the code of extensionElements and paste instead of it, and don't know why it can be work properly.

Thanks.

Outcomes