AnsweredAssumed Answered

AVM Workflow

Question asked by rdifrango on Sep 30, 2008
Latest reply on Sep 30, 2008 by rdifrango
I was looking for documentation on the workflow API's and I found the following post that was somewhat helpful:

http://forums.alfresco.com/en/viewtopic.php?f=27&t=14019&p=47827

The problem with the simple-avm-submit is that everything gets moved directly into staging without going through the approval process.  My guess is that the start-avm-workflow.  Is this correct if I want to have documents from contributors to land in the approvers task list?  If not what is the correct approach?  Also, does this action find every document that needs to be submitted?

Here is the start of my web script that work for the simple option:

script:
{
var storeid = "portal" +
((args.user != null) ? "–" + args.user : "");
var fullpath = "/www/avm_webapps/ROOT/";

if (fullpath.length == 0)
{
status.code = 400;
status.message = "Store id has not been provided.";
status.redirect = true;
break script;
}

// locate avm node from path
var store = avm.lookupStore(storeid);
if (store == undefined)
{
status.code = 404;
status.message = "Store " + storeid + " not found.";
status.redirect = true;
break script;
}
var node = avm.lookupNode(storeid + ":" + fullpath);

if (node != null)
{
var workflowType = "jbpm$wf:simple-avm-submit";

var description = args.desc;

var workflow = actions.create("simple-avm-submit");

workflow.parameters.workflowName = workflowType;

workflow.parameters["bpm:workflowDescription"] = description;

if ((args.duedate) && (args.duedate != ""))
{
var dueDate = new Date(args.duedate);
workflow.parameters["bpm:workflowDueDate"] = dueDate;
}

workflow.execute(node);
}

}

Outcomes