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 is not printing variable, it seems that the part of extensionElement has not been run?
The snippet of the bpmn diagram:
<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>
The snippet of the model file:
<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>
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.
Below is the code snippet which is working for me for using variable in next task.
Change activiti:taskListener to activiti:executionListener.