OK, I got it working how I want sort of now. It appears as though, if I hard code the assignee then it properly goes through the approval process. The question is, how do I dynamically find out from the workflow the assignee and if it is parallel or serial, etc.
Here is my code:
script:
{
var currentUser = null;
var impersonateUser = args.impersonate;
if (impersonateUser != null) {
currentUser = impersonation.impersonate(impersonateUser);
}
var storeid = "portal" +
((impersonateUser != null) ? "–" + impersonateUser : "");
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 = "Portal Checkin";
var workflow = actions.create("simple-avm-submit");
workflow.parameters.workflowName = workflowType;
workflow.parameters["bpm:workflowDescription"] = description;
var assignTo = people.getPerson("approver");
workflow.parameters["bpm:assignee"] = assignTo;
if ((args.duedate) && (args.duedate != ""))
{
var dueDate = new Date(args.duedate);
workflow.parameters["bpm:workflowDueDate"] = dueDate;
}
workflow.execute(node);
}
}