AnsweredAssumed Answered

[SOLVED]'bpm_assignee' is not defined.

Question asked by targa2000 on Mar 4, 2010
Latest reply on Mar 4, 2010 by targa2000
created a custom workflow defined in :

http://wiki.alfresco.com/wiki/WorkflowSample_Lifecycle

able to deploy it, and select it from the advanced workflow interface as one of the workflows, but during filling out the values in the GUI interface, can't assign assignees, the title: 'users and their roles' appears but can not select assignees.  able to complete the GUI, then after press final.  Following error occurs:

Caused by: org.jbpm.graph.def.DelegationException: 02040004 Failed to execute supplied script: 020
40003 ReferenceError: "bpm_assignee" is not defined. (AlfrescoJS#1)

made a slight modification to code in wiki :

for (var i in bpm_package.children)

instead of

for (var i = 0; i < bpm_package.children.length; i++)

but otherwise using same JPDL process definition file as in wiki.

Would anyone have any idea what I might be doing wrong?

JPDL process definition file:

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wfl:lifecycleapproval">

   <swimlane name="initiator" />

   <start-state name="start">
       <task name="wf:submitNewProjectRequest" swimlane="initiator" />

       <event type="node-leave">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i in bpm_package.children)
                   {
                      if (!bpm_package.children.hasAspect("wfl:status"))
                      {
                         bpm_package.children.addAspect("wfl:status");
                      }
                   }
               </script>
           </action>
       </event>

       <transition name="" to="review" />
   </start-state>

   <swimlane name="reviewer">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{bpm_assignee}</actor>
      </assignment>
   </swimlane>

   <task-node name="review">
       <event type="node-enter">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i in bpm_package.children)
                   {
                      bpm_package.children.properties["wfl:status"] = "In Review";
                      bpm_package.children.save();
                   }
               </script>
           </action>
       </event>

       <task name="wf:reviewTask" swimlane="reviewer">
           <event type="task-create">
               <script>
                   if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                   if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
               </script>
           </event>
       </task>
       
       <transition name="reject" to="rejected" />
       <transition name="approve" to="approved" />
   </task-node>

   <task-node name="rejected">
       <event type="node-enter">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i in bpm_package.children)
                   {
                      bpm_package.children.properties["wfl:status"] = "Draft";
                      bpm_package.children.save();
                   }
               </script>
           </action>
       </event>

       <task name="wf:rejectedTask" swimlane="initiator" />
       <transition name="" to="end" />
   </task-node>

   <task-node name="approved">
       <event type="node-enter">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i in bpm_package.children)
                   {
                      bpm_package.children.properties["wfl:status"] = "Approved";
                      bpm_package.children.save();
                   }
               </script>
           </action>
       </event>

       <task name="wf:approvedTask" swimlane="initiator" />
       <transition name="" to="end" />
   </task-node>

   <end-state name="end" />

   <event type="process-end">
       <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
               if (cancelled)
               {
                   for (var i in bpm_package.children)
                   {
                      if (bpm_package.children[0].hasAspect("wfl:status"))
                      {
                         bpm_package.children.properties["wfl:status"] = "Draft";
                         bpm_package.children.save();
                      }
                   }
                   if (logger.isLoggingEnabled()) logger.log("Workflow cancelled, status reset to Draft");
               }
               else               
               {
                   if (logger.isLoggingEnabled()) logger.log("Workflow completed");
               }
           </script>
       </action>
   </event>

</process-definition>


full error message:

Caused by: org.jbpm.graph.def.DelegationException: 02040004 Failed to execute supplied script: 020
40003 ReferenceError: "bpm_assignee" is not defined. (AlfrescoJS#1)
        at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignment(TaskMgmtInstance.java:298)
        at org.jbpm.taskmgmt.exe.TaskMgmtInstance.getInitializedSwimlaneInstance(TaskMgmtInstance.
java:260)
        at org.jbpm.taskmgmt.exe.TaskInstance.assign(TaskInstance.java:202)
        at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:223)
        at org.jbpm.graph.node.TaskNode.execute(TaskNode.java:174)
        at org.jbpm.graph.def.Node.enter(Node.java:390)
        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.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:15
7)
        at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$aca36f57.enter(<generated>)
        at org.jbpm.graph.def.Transition.take(Transition.java:167)
        at org.jbpm.graph.def.Node.leave(Node.java:479)
        at org.jbpm.graph.node.StartState.leave(StartState.java:82)
        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.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:15
7)
        at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$aca36f57.leave(<generated>)
        at org.jbpm.graph.exe.Token.signal(Token.java:223)
        at org.jbpm.graph.exe.Token.signal(Token.java:150)
        at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:490)
        at org.alfresco.repo.workflow.jbpm.WorkflowTaskInstance.end(WorkflowTaskInstance.java:141)

        at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:406)
        at org.alfresco.repo.workflow.jbpm.JBPMEngine$26.doInJbpm(JBPMEngine.java:1703)
        at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
        at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372
)
        at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:338
)
        at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
        at org.alfresco.repo.workflow.jbpm.JBPMEngine.endTask(JBPMEngine.java:1680)
        … 71 more
Caused by: org.alfresco.scripts.ScriptException: 02040004 Failed to execute supplied script: 02040
003 ReferenceError: "bpm_assignee" is not defined. (AlfrescoJS#1)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:
254)
        at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.jav
a:314)
        at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.jav
a:292)
        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:3
04)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(Reflective
MethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodIn
vocation.java:149)
        at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(Alway
sProceedMethodInterceptor.java:40)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodIn
vocation.java:171)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke
(ExceptionTranslatorMethodInterceptor.java:49)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodIn
vocation.java:171)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:148)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodIn
vocation.java:171)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionIn
terceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodIn
vocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204
)
        at $Proxy178.executeScriptString(Unknown Source)
        at org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript.executeScript(AlfrescoJavaScript.jav
a:178)
        at org.alfresco.repo.workflow.jbpm.AlfrescoAssignment.assign(AlfrescoAssignment.java:96)
        at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignmentDelegation(TaskMgmtInstance.jav
a:320)
        at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignment(TaskMgmtInstance.java:274)
        … 102 more
Caused by: org.alfresco.error.AlfrescoRuntimeException: 02040003 ReferenceError: "bpm_assignee" is
not defined. (AlfrescoJS#1)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.j
ava:472)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:
250)
        … 125 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "bpm_assignee" is not defined. (Alfre
scoJS#1)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
        at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3413)
        at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1612)
        at org.mozilla.javascript.gen.c15._c0(AlfrescoJS:1)
        at org.mozilla.javascript.gen.c15.call(AlfrescoJS)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
        at org.mozilla.javascript.gen.c15.call(AlfrescoJS)
        at org.mozilla.javascript.gen.c15.exec(AlfrescoJS)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.j
ava:456)
        … 126 more

Outcomes