cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with decision node

frontman
Champ in-the-making
Champ in-the-making
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.
2 REPLIES 2

sethatrothbury
Champ in-the-making
Champ in-the-making
Remove those log statements. The variable that you have write access on will be set to whatever the last line of code is in your expression statement.

This is an odd quirk, I know, but it should fix your problem. Just make sure that the "traduccion" variable is the last line of code in that block.

frontman
Champ in-the-making
Champ in-the-making
Like you said…it's an odd quirk but it works!!!

Thanks, Roth.