0

由于内容规则,我想自动为文件夹中的所有文件添加工作流。我已经看到一个工作流程已经存在(审核组),但我想添加一个仅允许站点经理验证文档的工作流程(经理审核)。我添加了一个 javascript 脚本,这是我的代码不起作用:

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:parallelgroupreview";
workflow.parameters.requiredApprovePercent = 20;
workflow.parameters["bpm:workflowDescription"] = "Please review and approve: " + document.name;
workflow.parameters["bpm:assignee"] = site.listMembers(null, "manager", 0, true);
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document); 

拜托,你能帮我吗,因为我有点困惑。

谢谢 !

4

1 回答 1

1

您必须稍作调整才能获取文档的 SiteManager-Group。以下代码段将启动并行组审核工作流程。我使用了基于 activiti 的工作流程,因为我建议使用 activiti 而不是 jbpm:

var ctx = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
var javaSiteService = ctx.getBean("siteService");
var site = javaSiteService.getSite(document.nodeRef);
var siteManagerGroup = javaSiteService.getSiteRoleGroup(site.getShortName(), "SiteManager", true);
var groupAssignee = people.getGroup(siteManagerGroup)

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiParallelGroupReview";
workflow.parameters.requiredApprovePercent = 20;
workflow.parameters["bpm:workflowDescription"] = "Please review and approve: " + document.name;
workflow.parameters["bpm:groupAssignee"] = groupAssignee;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);
于 2014-06-25T07:39:09.920 回答