cancel
Showing results for 
Search instead for 
Did you mean: 

Starting an advanced workflow with Javascript

nparry
Champ in-the-making
Champ in-the-making
Hi,

I've built a simple workflow and deployed it successfully with the jBPM GPD.  I'm trying to start it with a javascript, but I think I'm not seeing the connection between some of the variables.

This is the only code I could find on the topic.  If you have any other examples to point to, that would be great.


var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:review";
workflow.parameters["bpm:workflowDescription"] = document.name;
workflow.parameters["bpm:assignee"] = person;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);

My main question is where do the parameters from the bpm namespace come from, and how do I get make another namespace with my own parameters?

Also, as per the wiki, I replaced the line

workflow.parameters["bpm:assignee"] = person;

with the line

workflow.parameters["bpm:assignee"] = getPerson("username");

I got this error: ReferenceError: "getPerson" is not defined.
Why doesn't the engine recognize this function?

Thanks,
nparry
1 REPLY 1

davidc
Star Contributor
Star Contributor
I suggest reading through http://wiki.alfresco.com/wiki/WorkflowAdministration to get a better understanding of task properties.

getPerson is not a valid javascript function - there's a public javascript object called people which supports the getPerson function.

e.g. people.getPerson("username");

See http://wiki.alfresco.com/wiki/JavaScript_API