您应该发布您的工作流程代码,以便我们提供更好的解决方案。无论如何,最好的方法是在您的 Activiti(希望您使用的是 Activiti BPMN)任务中实现一段 javascript,该任务更改与 bpm 包(节点)关联的自定义属性,然后使用条件表达式检查属性值和执行过渡。例子:
<userTask id="activitiApprove" name="Document approve" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wfstu:activitiApprove">
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
for (var i = 0; i &lt; bpm_package.children.length; i++) {
var doc = bpm_package.children[i];
doc.properties['stu:customProperty']= "UPLOADED";
doc.save();
}
logger.log("My Workflow - Transition from start to activitiApprove");</activiti:string>
</activiti:field>
</activiti:taskListener>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>execution.setVariable('wfstu_approveReject', task.getVariable('wfstu_approveReject'))
wfstu_approveReject = "OK";</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<sequenceFlow id="flow2" sourceRef="activitiApprove" targetRef="decisionApprove"></sequenceFlow>
<exclusiveGateway id="decisionApprove" name="Approve decision"></exclusiveGateway>
<sequenceFlow id="flow3" sourceRef="decisionApprove" targetRef="approve">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${wfstu_approveReject == 'OK'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow4" sourceRef="decisioneApprovazione" targetRef="reject">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${wfstu_approveReject == 'KO'}]]></conditionExpression>
</sequenceFlow>
或类似的东西。