AnsweredAssumed Answered

How to send token to a specific superprocess's task?

Question asked by mguarinoni on Mar 18, 2011
Latest reply on Jul 19, 2011 by mguarinoni
Hi

I have a subprocess that is included in several major processes, but i don't know how to send the token to specific superprocess's task,
if token arrive to the end, no problem.

I want that rechazarBE(subprocess) send token to revisionGerenciaGeneral(superprocess),
I tried this..
       <node name="rechazarBE">   
      <transition to="../revisionGerenciaGeneral"></transition>            
   </node>
didn't work.

This is the main process.

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

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

   <swimlane name="initiator" />
   
   <start-state name="start">
        <task name="wf:submitGroupReviewTask" swimlane="initiator"/>        
              
        <transition to="revisionElaborador" name="a revisar">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <runas>admin</runas>
                <script>
               var divFolder = companyhome.childByNamePath(bpm_carpetaDivision);
                    var contador=divFolder.properties["an:Contador"];
                    if(contador==null) contador=0;
                    divFolder.properties["an:Contador"]=divFolder.properties["an:Contador"]+1;
                    divFolder.save();
                </script>               
            </action>
        </transition>
   </start-state>
   
   <swimlane name="elaborador">
       <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
             <pooledactors>#{bpm_groupAssignee}</pooledactors>
        </assignment>   
    </swimlane>
    <swimlane name="revisor1">
       <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
             <pooledactors>#{bpm_revisor1}</pooledactors>
        </assignment>   
    </swimlane>
    <swimlane name="divisional">
       <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
             <pooledactors>#{bpm_divisional}</pooledactors>
        </assignment>   
    </swimlane>
     <swimlane name="gerencia_general">
       <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
             <pooledactors>#{bpm_gerencia_general}</pooledactors>
        </assignment>   
    </swimlane>
   
   
   <task-node name="revisionElaborador">
      <task name="wf:reviewTask" swimlane="elaborador">
       <event type="task-create">                              
                   <script>                        
                       if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                       if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;                      
                   </script>
            </event>          
            <event type="task-end">
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                  <script>
                     <variable name="bpm_assignee" access="write"/>
                     <expression>
                        if (taskInstance.actorId != null)
                           people.getPerson(taskInstance.actorId);
                        else
                           person;                     
                     </expression>
                  </script>                  
               </action>
            </event>
        </task>                   
      <transition to="aprobarElaborador" name="aprobar">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaAprobacionRevision1);
                     bpm_package.children[0].move(dest);   
               </script>
          </action>        
      </transition>
      <transition to="rechazarElaborador" name="rechazarElaborador"></transition>          
   </task-node>
   <node name="aprobarElaborador">    
      <transition to="revisionRevisor1"></transition>             
   </node>
   <node name="rechazarElaborador">      
      <transition to="revisionElaborador"></transition>      
   </node>
   <task-node name="revisionRevisor1">
      <task name="wf:reviewTask" swimlane="revisor1"/>      
      <transition to="aprobarRevisor1" name="aprobar">
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaAprobacionDivisional);
                     bpm_package.children[0].move(dest);   
               </script>
          </action>      
      </transition>      
      <transition to="rechazarRevisor1" name="rechazarRevisor1">
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaElaboracion);
                     bpm_package.children[0].move(dest);   
               </script>
          </action>      
      </transition>
   </task-node>
   <node name="aprobarRevisor1">      
      <transition to="revisionDivisional"></transition>
   </node>
   <node name="rechazarRevisor1">
      <transition to="revisionElaborador"></transition>
   </node>


   <task-node name="revisionDivisional">
      <task name="wf:reviewTask" swimlane="divisional"/>
      <transition to="aprobarDivisional" name="aprobar">      
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                          var dest2 = companyhome.childByNamePath(bpm_carpetaEnviadaSG);
                     bpm_package.children[0].copy(dest2);
                        var dest = companyhome.childByNamePath(bpm_carpetaGG);
                     bpm_package.children[0].move(dest);                     
               </script>
          </action>
      </transition>
      <transition to="rechazarDivisional" name="rechazarDivisional">      
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaAprobacionRevision1);
                     bpm_package.children[0].move(dest);                        
               </script>
          </action>
      </transition>
   </task-node>   
   <node name="aprobarDivisional">   
      <transition to="revisionGerenciaGeneral" name=""></transition>      
   </node>
   <node name="rechazarDivisional">
      <transition to="revisionRevisor1"></transition>            
   </node>

   <task-node name="revisionGerenciaGeneral">
      <task name="wf:reviewTask" swimlane="gerencia_general"/>
      <transition to="aprobarGG" name="aprobar">      
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaBandejaEntradaRRHH);
                     bpm_package.children[0].move(dest);                     
               </script>
          </action>
      </transition>
      <transition to="rechazarGG" name="rechazarGG">      
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaAprobacionDivisional);
                     bpm_package.children[0].move(dest);                        
               </script>
          </action>
      </transition>
   </task-node>   
   <node name="aprobarGG">    
      <transition to="subprocessSG"></transition>      
   </node>
   <node name="rechazarGG">
      <transition to="revisionDivisional"></transition>            
   </node>
   
   <process-state name="subprocessSG">
      <sub-process name="wf_central_sg"/>
      <transition to="end"></transition>
      <transition to="revisionGerenciaGeneral" name="to revisionGerenciaGeneral"></transition>
      <variable name="companyhome"/>
      <variable name="bpm_package" access="read"/>   
      <variable name="initiator" access="read"/>      
      <variable name="bpm_aprobadores_sg" access="read"/>   
      <variable name="bpm_carpetaGG" access="read"/>
      <variable name="bpm_carpetaProyectoOrdenDia" access="read"/>
      <variable name="bpm_carpetaOrdenDia" access="read"/>   
      <variable name="bpm_carpetaBandejaEntradaRRHH" access="read"/>
      <variable name="bpm_carpetaAprobadasSinNumerar" access="read"/>
      <variable name="bpm_carpetaAprobadasNumeradas" access="read"/>
      <variable name="bpm_workflowDescription" mapped-name="bpm_workflowDescription1" access="read"/>         
   </process-state>

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

</process-definition>


This is the subprocess.

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

<process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="wf_central_sg">
  
   <start-state name="start">
        <task name="wf:submitGroupReviewTask" swimlane="initiator"/>
        <transition to="revisionBandejaEntradaRRHH" name="a revisar">        
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>
                <script>
               bpm_workflowDescription=bpm_workflowDescription1;
                </script>               
            </action>        
        </transition>
   </start-state>
   
   <swimlane name="aprobadores_sg">
       <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
             <pooledactors>#{bpm_aprobadores_sg}</pooledactors>
        </assignment>   
    </swimlane>
   
   <task-node name="revisionBandejaEntradaRRHH">
      <task name="wf:reviewTask" swimlane="aprobadores_sg"/> 
      <transition to="aprobarBE" name="aprobar enviar a Proy. orden del día">   
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaProyectoOrdenDia);
                     bpm_package.children[0].move(dest);   
               </script>
          </action>            
      </transition>  
      <transition to="rechazarBE" name="rechazar enviar a GG">   
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaGG);
                     bpm_package.children[0].move(dest);   
               </script>
          </action>            
      </transition>       
   </task-node>   
   <node name="aprobarBE">   
      <transition to="revisionProyectoOrdenDia"></transition>      
   </node>
   <node name="rechazarBE">   
      <transition to="../revisionGerenciaGeneral"></transition>            
   </node>
   
   <task-node name="revisionProyectoOrdenDia">
      <task name="wf:reviewTask" swimlane="aprobadores_sg"/>         
      <transition to="aprobarPOD" name="aprobar">
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaOrdenDia);
                     bpm_package.children[0].move(dest);   
               </script>
          </action>      
      </transition>
      <transition to="rechazarPOD" name="rechazar">
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaBandejaEntradaRRHH);
                     bpm_package.children[0].move(dest);   
               </script>
          </action>      
      </transition>
   </task-node>
   <node name="aprobarPOD">   
      <transition to="revisionOrdenDia" name=""></transition>      
   </node>
   <node name="rechazarPOD">
      <transition to="revisionBandejaEntradaRRHH" name="a revisar Gerencia General"></transition>            
   </node>
   
   <task-node name="revisionOrdenDia">
      <task name="wf:reviewTask" swimlane="aprobadores_sg"/>      
      <transition to="aprobarOD" name="aprobar">
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaAprobadasSinNumerar);
                     bpm_package.children[0].move(dest);   
               </script>
          </action>      
      </transition>      
      <transition to="rechazarOD" name="rechazar">
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaProyectoOrdenDia);
                     bpm_package.children[0].move(dest);   
               </script>
          </action>      
      </transition>
   </task-node>
   <node name="aprobarOD">   
      <transition to="revisionAprobadas"></transition>      
   </node>
   <node name="rechazarOD">
      <transition to="revisionProyectoOrdenDia"></transition>            
   </node>
   
   
   <task-node name="revisionAprobadas">
      <task name="wf:reviewTask" swimlane="aprobadores_sg"/>
      <transition to="aprobarASN" name="aprobar">      
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        bpm_workflowDescription=bpm_workflowDescription1;                        
                     var dest = companyhome.childByNamePath(bpm_carpetaAprobadasNumeradas);                     
                     bpm_package.children[0].move(dest);   
               </script>
          </action>
      </transition>
      <transition to="rechazarASN" name="rechazar">      
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <runas>admin</runas>                  
                  <script>
                        var dest = companyhome.childByNamePath(bpm_carpetaOrdenDia);
                     bpm_package.children[0].move(dest);   
               </script>
          </action>
      </transition>
   </task-node>
    <node name="aprobarASN">   
      <transition to="end"></transition>      
   </node>
   <node name="rechazarASN">
      <transition to="revisionOrdenDia"></transition>            
   </node>

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


I appreciate any help, Greetings

Outcomes