我正在努力通过一个简单的“完整” ScriptTaskListner在任务中获取“ bpm:outcome”变量。我添加我正在使用Activi WorkFlow Engine。
这是我的尝试:
var import = task.getVariable('bpm_outcome');
很奇怪...返回的值是“下一个”(!!?!?)
无论如何...我读到也许可以做到这一点:
TaskInstance ti = ... ti.getVariableLocally(“ bpm_outcome”);
或者
ti.getVariable(“ bpm_outcome”);
但我无法获得taskinstance ...任何建议吗?通过简单的task.getvariable尝试即可完美捕获其他“ wf:...”变量。
提前致谢!
在“活动”中(不同于JBPM),除“下一步” /“完成”外没有其他结果。
如果您查看Alfresco的默认审批流程,您会发现他们引入了一个新变量来查看结果:
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));
</activiti:string>
</activiti:field>
</activiti:taskListener>
任务模型:
<property name="wf:reviewOutcome">
<type>d:text</type>
<default>Reject</default>
<constraints>
<constraint name="wf:reviewOutcomeOptions" type="LIST">
<parameter name="allowedValues">
<list>
<value>Approve</value>
<value>Reject</value>
</list>
</parameter>
</constraint>
</constraints>
</property>
共享配置:
<field id="wf:reviewOutcome" label-id="workflow.field.outcome" set="response">
<control template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl" />
</field>
因此,Alfresco仅使用常规字段来确定结果。这样您的语法就可以了,您只需要获取正确的变量即可。在这种情况下,它是task.getVariable('wf_reviewOutcome')
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句