在某些情况下可能需要判断不同的数据跳转到不同的环节可以用条件环节或者条件分支
如果条件环节或者条件分支都不满足需求可以在onAfterAdvanceQuery事件中通过修改ProcessControl控制flowTo实现
如下是在活动环节2的onAfterAdvanceQuery事件中通过修改ProcessControl直接跳转到环节环节4
public static void businessActivity2AfterAdvanceQuery() { ProcessControl control = (ProcessControl) ContextHelper.getActionContext().getActionResult(); // 删除原来的后续环节 if (control.hasFlowTo()) { control.clearFlowTo(); } // 把businessActivity4创建为ProcessControl的可运行环节 String activityId = CommonUtils.createGUID(); RunnableActivity rn = new RunnableActivity("businessActivity4", "true", "true", "活动环节4", activityId); control.setRunableActivity(rn); // 创建新的ProcessControlItem ProcessControlItem item = new ProcessControlItem(); Task task = ProcessUtils.getProcessContext().getTask(); item.setProcess(task.getProcess()); item.setUnit("businessActivity4"); item.setActivityId(activityId); item.addExecutor(ContextHelper.getPersonMemberWithAgent()); item.addExecutorRange(ContextHelper.getPersonMemberWithAgent()); Task itemTask = item.getTask(); itemTask.setId(CommonUtils.createGUID()); itemTask.setEURL("$UI/appdemo/test/process/modifyFlowto/businessActivity4.a"); itemTask.setLock(CommonUtils.createGUID()); itemTask.setName("活动环节4:修改flowTo"); itemTask.setActivity("businessActivity4"); itemTask.setActivityInTemplate("businessActivity4"); item.getTask().setEURL("$UI/appdemo/test/process/modifyFlowto/businessActivity4.a"); control.addFlowTo(item);// 把创建的ProcessControlItem添加到ProcessControl中 }
评一波