AnsweredAssumed Answered

Can't get past event type 'task-end' with javascript action

Question asked by ericnk on Aug 2, 2011
Latest reply on Apr 23, 2012 by ericnk
Hello,

I have a workflow which won't transition because of a "task-end" event.  The event has a javascript action which assigns data to some variables.  In my efforts to trouble shoot the problem, I narrowed the problem to the "task-end" event.  When I removed this event from the workflow, the token advanced to the selected transition.

Here is the relevant section of the workflow….


   <task-node name="phaseTwo">
      <task name="stanwf:poPhaseTwoTask" swimlane="purchasingOperations">
         <event type="task-create">
            <script>
               if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
               if (bpm_workflowPriority != void)  taskInstance.priority = bpm_workflowPriority;
            </script>
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <runas>admin</runas>
               <script>
                  <variable name="phaseOneOption" access="read"/>
                  <variable name="orderDescription" access="read"/>
                  <variable name="phaseThreeRejected" access="read"/>
                  <variable name="bpm_package" access="read"/>
                  <variable name="initiator" access="read"/>
                  <expression>
                     <![CDATA[
                        <import resource="/Company Home/Data Dictionary/Scripts/powf-phase-two-task.js">
                     ]]>
                  </expression>
               </script>
            </action>
         </event>
         <event type="task-end">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <runas>admin</runas>
               <script>
                  <variable name="phaseTwoEmail" access="read,write"/>
                  <variable name="people" access="read"/>
                  <variable name="tiComments" access="read,write"/>
                  <variable name="tiRejectReason" access="read,write"/>
                  <expression>
                     <![CDATA[
                        <import resource="/Company Home/Data Dictionary/Scripts/powf-phase-two-taskEnd.js">
                     ]]>
                  </expression>
               </script>
            </action>
         </event>
         <timer duedate="3 hours" >
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="orderDescription" access="read"/>
                  <variable name="bpm_package" access="read"/>
                  <variable name="initiator" access="read"/>
                  <expression>
                     <![CDATA[
                        <import resource="/Company Home/Data Dictionary/Scripts/powf-phase-two-timer.js">
                     ]]>
                  </expression>
               </script>
            </action>
         </timer>
      </task>
      <transition name="Vendor Quote" to="phaseThree">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <runas>admin</runas>
            <script>
               <variable name="phaseTwoOption" access="write"/>
               <expression>
                  phaseTwoOption = 2;
               </expression>
            </script>
         </action>
      </transition>
      <transition name="Complete" to="phaseThree">
         <script>
            <variable name="phaseTwoOption" access="write"/>
            <expression>
               phaseTwoOption = 1;
            </expression>
         </script>
      </transition>
      <transition name="Reject" to="phaseOne">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <runas>admin</runas>
            <script>
               <variable name="orderDescription" access="read"/>
               <variable name="bpm_package" access="read"/>
               <variable name="initiator" access="read"/>
               <variable name="phaseTwoEmail" access="read"/>
               <variable name="tiComments" access="read"/>
               <variable name="tiRejectReason" access="read"/>
               <expression>
                  <![CDATA[
                     <import resource="/Company Home/Data Dictionary/Scripts/powf-phase-two-reject-transition.js">
                  ]]>
               </expression>
            </script>
         </action>
      </transition>
   </task-node>

Here is the entire javascript file imported into the "task-end" event….


phaseTwoEmail = people.getPerson(taskInstance.actorId);
tiComments = taskInstance.comments.get(0).message;
tiRejectReason = taskInstance.getVariable("stanwf_rejectReason");

I've enabled the javascript debugger and run through the javascript code.  It all executes as expected, assigning data to the variables, but when I step past the last line of code, a "failed to signal transition…" error occurs.  During my trouble shooting procedures I added test lines of code to the end of the javascript file to make sure the error isn't occurring on the last line.  It steps past the last line normally and executes the added test lines, but again, after stepping past the last added line, the error occurs.  Here is the error if it helps….


org.alfresco.service.cmr.workflow.WorkflowException: 07020003 Failed to signal transition Reject from workflow task jbpm$36515

I'm using alfresco version 3.4.d.  I'm at my wits end trying to solve this.  Any suggestions or comments are appreciated.  Thank you.

Regards,

Eric

Outcomes