AnsweredAssumed Answered

Check the group of the creator

Question asked by roseta on Nov 28, 2010
Latest reply on Nov 30, 2010 by roseta
I'm working with advanced workflows in xml files. In a certain node of my workflow, I would like to copy the document into a folder called "Professor" if the creator or the document is a professor, or to a folder called "student" if the creator is a student. I already know how to create folders and move docuements from a folder to another with Java Script, but my question is: How can I check to wich group belongs the creator or the document involved in my workflow?

This is the piece of my processdefinition.xml where I have to insert that piece of code I don't know…



<task-node name="reviewDocument">
        <task name="new:reviewDocumentTask" swimlane="reviewer">
        </task>
        <transition name="accept" to="end">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <runas>admin</runas>
                  <script>
                          <variable name="bpm_package" access="read" />
                          <expression>

                      if   ????????????

                          var origin = bpm_package.children[0].parent;
                          var root = origin.parent;
                          var destination = root.childByNamePath("Professor");
                          for (var i=0; i &lt; bpm_package.children.length; i++)
                          {
                              bpm_package.children[i].move(destination);
                          } 

                    else if  ???????????'

                          var origin = bpm_package.children[0].parent;
                          var root = origin.parent;
                          var destination = root.childByNamePath("Student");
                          for (var i=0; i &lt; bpm_package.children.length; i++)
                          {
                              bpm_package.children[i].move(destination);
                          }  

                  
                          </expression>
                  </script>
            </action>
   </transition>

Outcomes