简体   繁体   中英

Alfresco - Run a custom workflow after adding file


I need to implement my own action but I have no idea how to do this.
The goal is to make a rule on a prepared folder. When someone puts a file to it, alfresco is starting a new custom made workflow automatically, with attached file.
How to create that kind of function? Where to begin? I'm new to Alfresco.

Greetings, Rafał

Yes, @Gagravarr is right

Create a rule on folder In perform action you have to execute a script file which will be rest in your Data Dicionary/ Scripts folder

place this test.js file in Scripts folder and create a rule and in Perform Action execute script and select test.js file and create rule.

Sample script file for starting a workflow test.js activiti$test_wf replace with your custom workflow id.

function startWorkflow()
{
    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();

You should also look into behaviours, which are basically an extension point to Alfresco.

http://docs.alfresco.com/5.2/references/dev-extension-points-behaviors.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM