cancel
Showing results for 
Search instead for 
Did you mean: 

Why is this workflow failing to start?

fordville
Champ on-the-rise
Champ on-the-rise
Help!  This workflow won't start and I'm not seeing the issue!

I'm including my webscript JS below and the value of my variables are supplied in the model assignment lines below:


var nodeId = args.node_id;

var node = args.node_id;

if (node != null)
{
    var workflowType = "jbpm$" + args.type;

    var assignTo = people.getPerson(args.assignto);

    var description = args.desc;

    var workflow = actions.create("start-workflow");

    workflow.parameters.workflowName = workflowType;

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

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

    workflow.execute(node.nodeRef);
}

model.assignto = assignTo;  //Node Type: {http://www.alfresco.org/model/content/1.0}person   Node Ref: workspace://SpacesStore/70a6d0fe-0aa1-452b-97ae-b343e10a2654
model.node = node; //Node Type: {http://www.alfresco.org/model/content/1.0}person   Node Ref: workspace://SpacesStore/70a6d0fe-0aa1-452b-97ae-b343e10a2654
model.type = workflowType;  //jbpm$2  - the stock review and approve (single user) workflow…


Error that I'm getting is:

03190082 Wrapped Exception (with status template): 03190150 Failed to execute script '/start_workflow.post.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions)': 03190149 Can't find method org.alfresco.repo.jscript.ScriptAction.execute(org.mozilla.javascript.Undefined). (workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/start_workflow.post.js#21)

I'm not understand what is undefined!  I'd appreciate any pointers!

Bruce
1 REPLY 1

mitpatoliya
Star Collaborator
Star Collaborator
Hi Bruce,

I think according to Javascript API's list on wiki there is not method called "execute" in the workflow object.
May be that is the reason it is giving error on that line.
If you are trying to start the workflow with that method then you need to use "startWorkflow" api of workflow object.
where you need to pass the  set of workflow properties as an argument.