cancel
Showing results for 
Search instead for 
Did you mean: 

Decision node causing workflow exception

ericnk
Champ on-the-rise
Champ on-the-rise
Hi,

I'm writing a custom workflow that contains decision nodes that are causing a workflow exception.  It's a modified version of a custom serial workflow I found on the web.  The workflow is as follows…


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

<process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="stanwf:taskExecuteSerialReview">

<swimlane name="initiator" />

<start-state name="startTask">
  <description>
    Start the serial review approve task process
  </description>
  <task  name="stanwf:startSerialTask" description="Submit Task Execute Serial Review Task" swimlane="initiator"/>
  <transition to="taskMain" name="to Task Main" />
</start-state>

<task-node name="taskMain">
  <task name="stanwf:executeSerialTask">
    <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
      <actor>#{bpm_assignees.get(0)}</actor>
    </assignment>
    <event type="task-create">
      <script>
        if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
        if (bpm_workflowPriority != void)  taskInstance.priority = bpm_workflowPriority;
        if (taskDef != void) taskInstance.description = taskDef;
        if (rejectReason != void) taskInstance.rejectReason = rejectReason;
      </script>
    </event>
  </task>
  <transition name="Complete" to="onlyOne">
    <script>
      <variable name="approveCount" access="write"/>
      <expression>approveCount = 1;</expression>
    </script>
  </transition>
</task-node>

<decision name="onlyOne">
  <transition name="Yes" to="reviewSingleTask">
    <condition> #{bpm_assignees.size() == 1}</condition>
  </transition>
  <transition name="No" to="reviewTask">
    <condition> #{bpm_assignees.size() > 1}</condition>
  </transition>
</decision>

<task-node name="reviewTask">
  <task name="stanwf:reviewSerialTask" >
    <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
      <actor>#{bpm_assignees.get(approveCount)}</actor>
    </assignment>
    <event type="task-create">
      <script>System.out.println("-Task–first_review–"+approveCount+"-reviewerCount-"+reviewerCount);</script>
      <script>
        if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
        if (bpm_workflowPriority != void)  taskInstance.priority = bpm_workflowPriority;
        if (taskDef != void) taskInstance.description = taskDef;
        if (rejectReason != void) taskInstance.rejectReason = rejectReason;
      </script>
    </event>
  </task>
  <event type="node-enter">
    <script>
      <variable name="reviewerCount" access="write"></variable>
      <expression>reviewerCount = bpm_assignees.size();</expression>
    </script>
  </event>
  <event type="node-leave">
    <script>
      <variable name="rejectReason" access="write"></variable>
      <expression>rejectReason = taskInstance.rejectReason;</expression>
    </script>
  </event>
  <transition name="Approve" to="isLast">
    <script>
      <variable name="approveCount" access="read,write"/>
      <expression>approveCount = approveCount + 1 ;</expression>
    </script>
  </transition>
  <transition name="Reject" to="isFirst">
    <script>
      <variable name="approveCount" access="read,write"/>
      <expression>approveCount = approveCount - 1 ;</expression>
    </script>
  </transition>
</task-node>

<decision name="isLast">
  <transition name="No" to="reviewTask">
    <condition> #{approveCount &lt; reviewerCount}</condition>
  </transition>
  <transition name="Yes" to="finalSubmit">
    <condition> #{approveCount == reviewerCount}</condition>
  </transition>
</decision>

<decision name="isFirst">
  <transition name="No" to="reviewTask">
  </transition>
  <transition name="Yes" to="taskMain">
    <condition> #{approveCount &lt; 1 }</condition>
  </transition>
</decision>

<task-node name="reviewSingleTask">
  <task name="stanwf:reviewSerialTask" swimlane="initiator">
    <event type="task-create">
      <script>
        if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
        if (bpm_workflowPriority != void)  taskInstance.priority = bpm_workflowPriority;
        if (taskDef != void) taskInstance.description = taskDef;
      </script>
    </event>
  </task>
  <transition name="Approve" to="end"/>
  <transition name="Reject" to="taskMain">
    <script>
      <variable name="rejectReason" access="read,write"></variable>
      <expression>rejectReason = taskInstance.rejectReason;</expression>
    </script>
  </transition>
</task-node>

<task-node name="finalSubmit"  >
  <task name="stanwf:reviewSerialTaskResults" swimlane="initiator" ></task>
  <transition name="Finish" to="end"></transition>
</task-node>

<end-state name="end" />

</process-definition>

When I execute the workflow to the point where the decision node is, I get the following error….


org.alfresco.service.cmr.workflow.WorkflowException: 03140000 Failed to signal transition Complete from workflow task jbpm$10208.

I know it's the decision node that is causing the exception because when I change the workflow to bypass the decision nodes, it works.  Not like I want it to of course, as I need those decision nodes for the workflow logic.  Is there a way to see the entire stack trace of the workflow exception mentioned above?  I've looked through the log4j.properties file, but I'm not sure which of those properties I need to change to debug in order to see the exception details.

Any suggestions or comments are appreciated.  I look forward to any replies.  Thank you.

Eric
1 REPLY 1

mitpatoliya
Star Collaborator
Star Collaborator
Hi Eric,

Problem with your decision node is that in condition tag you need to replace ">" with "&lt;" and reverse the order
because as as process definition file is itself an XML file you cannot user these characters for comparison.
Hope this is the only problem.