AnsweredAssumed Answered

trying to create a simple-workflow action

Question asked by pchoe on Sep 18, 2012
Latest reply on Sep 21, 2012 by mitpatoliya
I am trying to create a simple-workflow action with javascript.  I have the following javascript so far:


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

if(!document.hasAspect("app:simpleworkflow")){
   document.addAspect("app:simpleworkflow");
}
document.properties.approveStep = "Approve";
document.properties.approveMove = "true";
document.properties.approveFolder = "workspace://SpacesStore/xxxxxxx"
   
document.properties.rejectStep = "Reject";
document.properties.rejectMove = "true";
document.properties.rejectFolder = "workspace://SpacesStore/xxxxxxx";
document.save();
workflow.parameters["bpm:workflowDescription"] = document.name;
var poolGroup = people.getGroup("GROUP_xxxxx");
workflow.parameters["bpm:groupAssignee"] = poolGroup;
var futureDate = new Date(); futureDate.setDate(futureDate.getDate() + 1);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.parameters.workflowName = "activiti$activitiReviewPooled";
workflow.execute(document);

The problem that I am having is that I get the following error when trying to execute the workflow:



Caused by: org.alfresco.service.cmr.rule.RuleServiceException: 08180227 A value for the mandatory parameter approve-step has not been set on the rule item simple-workflow
        at org.alfresco.repo.action.ParameterizedItemAbstractBase.checkMandatoryProperties(ParameterizedItemAbstractBase.java:158)
        at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:188)
        at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:790)
        at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:701)
        at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:539)
        at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:525)
        at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:799)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:159)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy44.executeAction(Unknown Source)
        at org.alfresco.repo.jscript.ScriptAction.executeImpl(ScriptAction.java:166)
        at org.alfresco.repo.jscript.ScriptAction.execute(ScriptAction.java:136)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
        at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
        at org.mozilla.javascript.gen.c28._c0(workspace://SpacesStore/2b55348e-6cac-4978-8813-9d556f106081:20)
        at org.mozilla.javascript.gen.c28.call(workspace://SpacesStore/2b55348e-6cac-4978-8813-9d556f106081)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
        at org.mozilla.javascript.gen.c28.call(workspace://SpacesStore/2b55348e-6cac-4978-8813-9d556f106081)
        at org.mozilla.javascript.gen.c28.exec(workspace://SpacesStore/2b55348e-6cac-4978-8813-9d556f106081)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:492)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:248)
        … 35 more

How can I set the mandatory parameters for the rule item simple-workflow?

Outcomes