workflow - how to set a variable in startevent in alfresco? -
i want property value mcwf:status
model in startevent
. need pass value of mcwf:status
other forms.
below code, not printing variable, seems part of extensionelement has not been run?
the snippet of 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 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 change startevent
usertask
, copy code of extensionelements , paste instead of it, , don't know why can work properly.
below code snippet working me using variable in next task.
<startevent id="startevent2" name="start" activiti:initiator="${initiator.properties.username}" activiti:formkey="aw:transportmanager"> <extensionelements> <activiti:executionlistener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.scripttasklistener"> <activiti:field name="script"> <activiti:string> <![cdata[ execution.setvariable('aw_vehicle_number', task.getvariable('aw_vehicle_number')); execution.setvariable('aw_reg_number', task.getvariable('aw_reg_number')); execution.setvariable('bpm_workflowdescription', task.getvariable('bpm_workflowdescription')); execution.setvariable('aw_finance_comments',task.getvariable('bpm_comment')); ]]></activiti:string> </activiti:field> </activiti:executionlistener> </extensionelements> </startevent>
change activiti:tasklistener activiti:executionlistener.
Comments
Post a Comment