简体   繁体   English

Alfresco社区版5.1.x如何使用Web脚本(Java或JavaScript)启动工作流程?

[英]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.

相关问题 Alfresco社区版5.1.x可以使用自定义javascript启动工作流程 - Alfresco community edition-5.1.x is possible to start workflow using custom javascript Alfresco community5.1.x /公司主页/数据字典/脚本/triggerStartworkflow.js如何从客户端执行javascript这可能吗? - Alfresco community5.1.x /Company Home/Data Dictionary/Scripts/triggerStartworkflow.js how can execute from clients javascript is this possible? 我们可以向Alfresco社区版添加自定义javascript和CSS吗? - Can we add custom javascript and css to Alfresco community edition? alfresco的javascript(不是webscript)机制如何 - How does alfresco's javascript( not webscript) mechanism 从Alfresco中的Java Webscript调用js Webscript - Call js webscript from Java webscript in Alfresco 如何在JavaScript文件中获取Alfresco Webscript JSON响应 - How to get Alfresco webscript JSON response in JavaScript file 露天工作流程没有看到webscript变量 - alfresco workflow isn't seeing webscript variables 如何在Alfresco 4中以后台脚本的形式发送电子邮件? - How to send email as webscript in background in alfresco 4? 在Alfresco中创建JavaScript工作流 - Create a javascript workflow in Alfresco 如何使用 jsPlumb 社区版创建节点 - How to create Nodes using jsPlumb community edition
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM