AnsweredAssumed Answered

how to start workflow from javascript service?

Question asked by rascio on Mar 25, 2011
Latest reply on Nov 17, 2011 by fufler
hello,
i'm trying to start a workflow from the javascript service:

        var registrationWorkflowDefinition = workflow.getDefinitionByName("jbpm$" + registrationType);
   
   var parameters = new Object();
   parameters["bpm:workflowDescription"] = getRegistrationLabelForDescription(registrationType) + ' registration for ' + node.name;
   parameters["bpm:assignees"] = [person];
   
   var registrationPackage = packagesFolder.createNode('test', 'bpm:package');
   registrationPackage.addNode(node);
   
   var registrationWorkflowStart = registrationWorkflowDefinition.startWorkflow(parameters, registrationPackage);
but when the code is execute throw the following exception:
Caused by: org.mozilla.javascript.EvaluatorException: Can't find method org.alfresco.repo.workflow.jscript.JscriptWorkflowDefinition.startWorkflow(object,org.alfresco.repo.jscript.ScriptNode). (file:/home/manuel/Progetti/ICCROM/alfresco/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/iccrom/registration/startregistration.post.js#23)
   at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
   at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1030)
   at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1086)
   at org.mozilla.javascript.Context.reportRuntimeError1(Context.java:1049)
   at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:162)
   at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)

Anyone can help me?

Outcomes