AnsweredAssumed Answered

mandatory parameter workflow-name has not been set

Question asked by rdifrango on Oct 13, 2008
Latest reply on Nov 24, 2009 by jipps
I am attempting to execute a workflow via the Javascript API and I am getting the following exception:


<message>
Failed to execute script '/org/hhmi/startWorkflow.post.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts)': Failed to execute script '/org/hhmi/startWorkflow.post.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts)': Wrapped org.alfresco.service.cmr.rule.RuleServiceException: A value for the mandatory parameter workflow-name has not been set on the rule item start-avm-workflow (AlfrescoScript#53)
</message>

<exception>
org.alfresco.scripts.ScriptException - Failed to execute script '/org/hhmi/startWorkflow.post.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts)': Failed to execute script '/org/hhmi/startWorkflow.post.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts)': Wrapped org.alfresco.service.cmr.rule.RuleServiceException: A value for the mandatory parameter workflow-name has not been set on the rule item start-avm-workflow (AlfrescoScript#53)
</exception>

<callstack>

      org.alfresco.service.cmr.rule.RuleServiceException: A value for the mandatory parameter workflow-name has not been set on the rule item start-avm-workflow
         org.alfresco.repo.action.ParameterizedItemAbstractBase.checkMandatoryProperties(ParameterizedItemAbstractBase.java:164)
         org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:117)
         org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:537)
         org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:472)
         org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:399)
         org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:387)
         org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:545)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
         org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
         org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
         org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
         org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:245)
         org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
         org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
         org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
         $Proxy18.executeAction(Unknown Source)
         org.alfresco.repo.jscript.ScriptAction.execute(ScriptAction.java:142)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
         org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
         org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3237)
         org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2394)
         org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
         org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
         org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
         org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:173)
         org.mozilla.javascript.Context.evaluateString(Context.java:1196)
         org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:396)
         org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:114)
         org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:243)
         org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:108)
         org.alfresco.web.scripts.AbstractWebScript.executeScript(AbstractWebScript.java:632)
         org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:116)
         org.alfresco.repo.web.scripts.RepositoryContainer$1.execute(RepositoryContainer.java:309)
         org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:294)
         org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:209)
         org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:320)
         org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:264)
         org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:240)
         org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:139)
         org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
         org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
         org.alfresco.web.app.servlet.MTWebScriptAuthenticationFilter.doFilter(MTWebScriptAuthenticationFilter.java:102)
         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
         org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
         org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
         org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
         org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
         org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
         org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
         org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
         java.lang.Thread.run(Thread.java:613)
      org.mozilla.javascript.WrappedException: Wrapped org.alfresco.service.cmr.rule.RuleServiceException: A value for the mandatory parameter workflow-name has not been set on the rule item start-avm-workflow (AlfrescoScript#53)
      org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1757)
      org.alfresco.error.AlfrescoRuntimeException: Wrapped org.alfresco.service.cmr.rule.RuleServiceException: A value for the mandatory parameter workflow-name has not been set on the rule item start-avm-workflow (AlfrescoScript#53)
      org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:403)
      org.alfresco.scripts.ScriptException: Failed to execute script '/org/hhmi/startWorkflow.post.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts)': Wrapped org.alfresco.service.cmr.rule.RuleServiceException: A value for the mandatory parameter workflow-name has not been set on the rule item start-avm-workflow (AlfrescoScript#53)
      org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:118)
      org.alfresco.scripts.ScriptException: Failed to execute script '/org/hhmi/startWorkflow.post.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts)': Failed to execute script '/org/hhmi/startWorkflow.post.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts)': Wrapped org.alfresco.service.cmr.rule.RuleServiceException: A value for the mandatory parameter workflow-name has not been set on the rule item start-avm-workflow (AlfrescoScript#53)
      org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:247)
</callstack>

Here is my Javascript code that gets executed:


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);

   // var version = server.version;
   // var versionNum = parseFloat(version);
   // var diffs = avmSyncService.compare(versionNum, path, -1, path, null);

   if (node != null) {
      var workflowType = "submit";

      var description = args.desc;

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

      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);
   }
}

I did a dump of all the "defined" work flows and here is what I see


<workflows>
            <workflow>
            <id>jbpm$524291</id>
            <name>jbpm$wcmwf:changerequest</name>
            <version>1</version>
            <title>Change Request</title>
            <description>Assign an asset for modification</description>

        </workflow>
        <workflow>
            <id>jbpm$524290</id>
            <name>jbpm$wcmwf:submit</name>
            <version>1</version>
            <title>Web Site Submission</title>
            <description>Submit changes for approval</description>

        </workflow>
        <workflow>
            <id>jbpm$524289</id>
            <name>jbpm$wf:adhoc</name>
            <version>1</version>
            <title>Adhoc Task</title>
            <description>Assign task to colleague</description>

        </workflow>
        <workflow>
            <id>jbpm$524292</id>
            <name>jbpm$wf:invite</name>
            <version>1</version>
            <title>Site Invite</title>
            <description>Invite to a Share Site</description>

        </workflow>
        <workflow>
            <id>jbpm$524288</id>
            <name>jbpm$wf:review</name>
            <version>1</version>
            <title>Review amp; Approve</title>
            <description>Review amp; approval of content</description>

        </workflow>
</workflows>

I wanted to simulate the Submit All, so I was using the jbpm$wcmwf:submit and I tried all various permutations of this name and it did not work.  Any help would be appreciated.

Outcomes