在Alfresco中使用规则和简单的javascript开始非常简单,但我一直试图通过javascript添加资源来启动工作流程.
我的目标是添加用于启动流程的文档(或文档),这样我就可以在Alfresco WorkDesk的Alfresco BPM的“OW_ATTACHMENTS”中获得引用.
我用bpm尝试了很多次:workflowpagckage或bpm:包没有运气….帮助!
编辑:
function startWorkflow(name,docNode)
{
var workflow = actions.create("start-workflow");
workflow.parameters["bpm:workflowPackage"] = docNode;
workflow.parameters.workflowName = "activiti$AdHocactivitiTimer";
workflow.parameters["bpm:assignee"] = people.getPerson("admin");
workflow.parameters["bpm:workflowDescription"] = "test";
workflow.parameters["bpm:workflowPriority"] = "2";
workflow.parameters["bpm:sendEMailNotifications"] = true;
workflow.parameters["initiator"] = people.getPerson("admin");
var today = new Date();
var duedate = today.getDate() + 1;
workflow.parameters["bpm:workflowDueDate"] = duedate;
workflow.execute(document);
}
function main()
{
var docNode = search.findNode(document.nodeRef);
var name = document.name;
startWorkflow(name,docNode);
}
main();
谢谢!
解决方法:
启动前bpm:package或bpm_package不可用.
那么你将文件添加到bpm_package会发生什么.
在您的工作流程中,您可以将bpm_package作为变量访问.并使用bpm_package.addNode(doc);你可以添加节点.
可以通过search / childbynamepath / xpath等找到这些节点.
如果您不使用该操作,则另一种方式是:
var workflowAction = workflow.getDefinitionByName('activiti$AdHocactivitiTimer');
var package= workflow.createPackage();
package.addNode(document);
workflowAction.startWorkflow(package, parameters);