AnsweredAssumed Answered

Problems with decision node

Question asked by frontman on Apr 14, 2010
Latest reply on Apr 15, 2010 by frontman
Hi everyone.

I have a problem with a decision node and I don't know what to do.

Within process definition, there is a task node named "revisarPropsDoc", which has a transition to decision node "requiereTraduccion?" and here comes the problem.


<start-state name="start">
   <task name="wf:iniciarFlujo" swimlane="initiator"/>
      <transition name="" to="revisarPropsDoc"/>
</start-state>

<task-node name="revisarPropsDoc">
      <task name="wf:revisarPropiedades" swimlane="initiator"/>
      <transition name="" to="requiereTraduccion?"/>
</task-node>

<decision name="requiereTraduccion?">
   <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <script>
            <variable name="traduccion" access="read,write"/>
            <variable name="bpm_package" access="read"/>
            <expression>
      logger.log("entrando a: requiereTraduccion?");
      logger.log(bpm_package.children[0].hasAspect("ps:konexo"));
      logger.log(bpm_package.children[0].properties["cm:name"]);
      logger.log(bpm_package.children[0].properties["ps:traduccion"]);
           
      if(bpm_package.children[0].properties["ps:traduccion"]=="Si")
              {
         traduccion = "si";
         logger.log("el contenido requiere traduccion");
            }else{
         traduccion = "no";
         logger.log("el contenido no requiere traduccion");
      }

      logger.log(traduccion);

      </expression>
         </script>
         </action>
      </event>
   <transition to="realizarTraduccion" name="">
         <condition>#{traduccion == "si"}</condition>
      </transition>
      <transition to="requiereAprobacion?" name=""></transition>
   </decision>

<swimlane name="traductores">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <pooledactors>#{people.getGroup("GROUP_traductores")}</pooledactors>
      </assignment>
   </swimlane>
  
   <task-node name="realizarTraduccion">
      <task name="wf:realizarTraduccion" swimlane="traductores">
            <event type="task-end">
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                  <script>
                     <variable name="bpm_assignee" access="write"/>
                     <expression>
            logger.log("entrando a: realizarTraduccion");
                        if (taskInstance.actorId != null)
                           people.getPerson(taskInstance.actorId);
                        else
                           person;
                     </expression>
                  </script>
               </action>
            </event>
        </task>
        <transition name="" to="aprobarContenido"/>
   </task-node>

<decision name="requiereAprobacion?">
      <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <script>
      <variable name="bpm_groupAssignee" access="read"/>
            <variable name="aprobacion" access="read,write"/>
            <variable name="bpm_package" access="read"/>
            <expression>
            if(bpm_package.children[0].properties["ps:aprobacion"]=="Si")
                  {
            logger.log("entrando a: requiereAprobacion?");
            logger.log(bpm_package.children[0].properties["ps:aprobacion"]);
            logger.log("el contenido requiere aprobacion");
                        aprobacion = "si";
                  }else{
            aprobacion = "no";
            logger.log("el contenido no requiere aprobacion");
      }           
            </expression>
         </script>
         </action>
      </event>
      <transition to="flujoCompletado" name=""></transition>  
      <transition to="aprobarContenido" name="">
         <condition>#{aprobacion == "si"}</condition>
      </transition>  
   </decision>

Even if "traduccion" is equal to "si", the transition goes to "requiereAprobacion?" directly instead of "realizarTraduccion".

Help me, please. It's very urgent.

Thanks in advanced.

Outcomes