[英]Alfresco community edition-5.1.x how can i start workflow using webscript (java or javascript)?
Alfresco community 5.1.x, i have create custom workflow i need to trigger via webscripts (java or javascript) is possible? Alfresco社区5.1.x,我创建了自定义工作流程,需要通过网页脚本(java或javascript)触发吗? Please help me with steps because of am new to alfresco?
因为露天的新事物,请帮助我采取一些步骤?
js-api maybe can help you: https://github.com/Alfresco/alfresco-js-api js-api可能可以帮助您: https : //github.com/Alfresco/alfresco-js-api
//Call a GET on a Web Scripts available at the following URIs: http://127.0.01:8080/alfresco/service/mytasks
this.alfrescoJsApi.webScript.executeWebScript('GET', 'mytasks').then(function (data) {
console.log('Data received form http://127.0.01:8080/alfresco/service/mytasks' + data);
}, function (error) {
console.log('Error' + error);
});
//Call a GET on a Web Scripts available at the following URIs: http://127.0.01:8080/share/service/mytasks
this.alfrescoJsApi.webScript.executeWebScript('GET', 'mytasks', null, 'share').then(function (data) {
console.log('Data received form http://127.0.01:8080/share/service/mytasks' + data);
}, function (error) {
console.log('Error' + error);
});
//Call a GET on a Web Scripts available at the following URIs: http://127.0.01:8080/share/differentServiceSlug/mytasks
this.alfrescoJsApi.webScript.executeWebScript('GET', 'mytasks', null, 'share', 'differentServiceSlug').then(function (data) {
console.log('Data received form http://127.0.01:8080/share/differentServiceSlug/mytasks' + data);
}, function (error) {
console.log('Error' + error);
});
You can call your repo webscript using AJAX like this 您可以像这样使用AJAX调用您的回购网页脚本
var mylink=encodeURI("/webscript-url?parameter1="+value1);
Alfresco.util.Ajax.request({
url: Alfresco.constants.PROXY_URI + mylink,
method: Alfresco.util.Ajax.GET,
});
Place this code in your repo webscript's JS file and Change the required properties according to your requirement. 将此代码放在您的回购Web脚本的JS文件中,然后根据需要更改所需的属性。
function startWorkflow()
{
var value2 = args["parameter1"];// you can get parameter by this
var workflowAction = workflow.getDefinitionByName("activiti$test_wf");
var package= workflow.createPackage();
var wfparams = new Array();
wfparams["model_prefix:req_props_name"] = value2;
wfparams["bpm:assignee"] = people.getPerson("admin");
workflowAction.startWorkflow(package, wfparams);
}
}
startWorkflow();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.