0

Alfresco 社区 5.1.x,我创建了需要通过 webscripts(java 或 javascript)触发的自定义工作流程是可能的吗?由于我是露天的新手,请帮助我完成步骤?

4

2 回答 2

0

您可以像这样使用 AJAX 调用您的 repo webscript

 var mylink=encodeURI("/webscript-url?parameter1="+value1);

                    Alfresco.util.Ajax.request({

                              url: Alfresco.constants.PROXY_URI + mylink,

                              method: Alfresco.util.Ajax.GET,

                    });

将此代码放在您的 repo webscript 的 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();
于 2017-01-31T04:13:44.413 回答
0

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);
});
于 2016-07-15T10:09:54.413 回答