AnsweredAssumed Answered

Workflow Decision Node

Question asked by tonyfoo on Feb 9, 2010
Latest reply on Feb 10, 2010 by tonyfoo
Hi All,

I recently began creating an advanced workflow within Alfresco 3.1. At the moment the workflow is a pretty simple approval flow, however I am unable to get  a decision node to properly transition the flow in the right direction.

EX: The decision node should allow the token to the "Run Student Match" node only if the document is an xml document. Otherwise the flow should be sent towards the "Trigger Checklist Update" node. Please see my process definition below:

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

   
   <swimlane name="initiator">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{bpm_assignee}</actor>
      </assignment>
   </swimlane>
   
   
   <start-state name="Assign Document Code">
      <task name="scwf:assignDocCode" swimlane="initiator"/>
      <transition to="Assign Code"></transition>
   </start-state>
   
   <node name="Assign Code">
   <event type="node-enter">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              
            <script>
               <variable name="bpm_package" access="read"/>
               <expression>
               logger.log("Transcript Process: Assign Document Code");
               if (!bpm_package.children[0].hasAspect("my:TranscriptFields"))
                  {
                        bpm_package.children[0].addAspect("my:TranscriptFields");
                  }
               bpm_package.children[0].properties["my:ID"] = "123456";
                  bpm_package.children[0].properties["my:RecievedDate"] = new Date();
                  bpm_package.children[0].properties["my:LastName"] = "xml";
                  bpm_package.children[0].save();
               </expression>
               </script>
                            
         </action>
      </event>
      <transition to="Is APAS Transcript?"></transition>
   </node>


   <decision name="Is APAS Transcript?">
      <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <script>
            <variable name="mime" access="read,write"/>
            <variable name="bpm_package" access="read"/>
            <expression>
            if (bpm_package.children[0].properties.content.mimetype=="text/xml")
                  {
                        mime="xml";
                  }
            </expression>
         </script>
         </action>
      </event>
      <transition to="Trigger Checklist Update" name="no"></transition>   
      <transition to="Run Student Match" name="">
         <condition>#{mime == "xml"}</condition>
      </transition>   
   </decision>


   <task-node name="Run Student Match">
      <task name="scwf:studentMatch" swimlane="initiator"/>
      <transition to="Trigger Checklist Update"></transition>
   </task-node>
<!–
   <decision name="Student found">
      <transition to="Trigger Checklist Update" name="yes"></transition>
      <transition to="Manual Update of Transcript Metadata" name="no"></transition>
   </decision>
–>
   <task-node name="Trigger Checklist Update">
      <task name="scwf:checklistUpdate" swimlane="initiator"/>
      <transition to="Apply Metadata from APAS Document"></transition>
   </task-node>

<!–
   <node name="Apply Student Metadata from Kofax">
      <transition to="Run Student Match"></transition>
   </node>
–>
   <node name="Apply Metadata from APAS Document">
      <transition to="Manual Update of Transcript Metadata"></transition>
   </node>

   <task-node name="Manual Update of Transcript Metadata">
      <task name="scwf:updateTranscriptMetadata" swimlane="initiator"/>
      <transition to="end"></transition>
   </task-node>
<!– 
   <node name="Trigger Evaluator Workflow">
      <transition to="end"></transition>
   </node>
–>

   <end-state name="end"></end-state>



</process-definition>


Any help would be greatly appreciated!

Thanks,
Kyle

Outcomes