在流程模版管理中给相关组织设置了流程模版后要在process的启动规则中设置流程模版选择流程模版函数才可以
如果不在启动规则中设置,可以在process的onBeforeStart事件中代码控制,如下:
public static void andProcessBeforeStart() {
String temp = TemplateHelper.findTemplateByCurrentPerson(ContextHelper.getActionContext().getProcess().getFullName());//获取当前人的流程模板
if (Utils.isNotEmptyString(temp)) {
Map<String, Object> map = (Map<String, Object>) ContextHelper.getActionContext().getParameter("attributes");
if (map == null) {
map = new HashMap<String, Object>();
ContextHelper.getActionContext().setParameter("attributes", map);
}
map.put("sProcessTemplateID2", temp);//设置流程模版
}
}
本例获取流程模版用的是findTemplateByCurrentPerson获取当前人的流程模板这个函数的API,如果不满足需要可以自己调用其他的API获取
评一波