AnsweredAssumed Answered

Workflow Parallel Group Review with Move

Question asked by atoops on Oct 22, 2013
Latest reply on Oct 23, 2013 by atoops
Hello, I am trying to create a jbpm workflow that assigns review tasks to a group of users.  The user group would then approve the document and it would need 100% approval, if 100% is attained it would move the document to Final Document Folder with it Site Document Lib. (/sites/test/documentLibrary/D-Final-Document).  If 100% approval is not attained it moves it to a Review Needed Folder with in Site Document Lib (/sites/test/documentLibrary/C-Rejected-Updates-Needed). 

I am new so I am trying to educate myself with previous examples from the forums and docs from the wiki. My specific issue is I keep getting the following error:
"Failure: Failed to execute script 'workspace://SpacesStore/82845e4a-85cc-4a91-8153-7c1576736f07': 09220111 Mandatory task properties have not been provided! {http://www.alfresco.org/model/bpm/1.0}groupAssignee"

Where I am completely confused is I don't have groupAssignee in the process definition or in the script that calls the workflow.  Can someone take a peek and push me in the right direction.  Any help is much appreciated, as always.

SCRIPT (this is being executed with the execute script, by a folder rule when anything enters the folder)

function startWorkflow(assigneeGroup)
{
   var workflow = actions.create("start-workflow");
   workflow.parameters.workflowName = "jbpm$wf:parallelgroupreview";
   workflow.parameters.requiredApprovePercent = 100;
   workflow.parameters["bpm:workflowDescription"] = "Please review " + document.name;
   workflow.parameters["bpm:assignees"] = [people.getPerson("boss"), people.getPerson("aaron")];
   var futureDate = new Date();
   futureDate.setDate(futureDate.getDate() + 7);
   workflow.parameters["bpm:workflowDueDate"] = futureDate;
   workflow.parameters["bpm:rejectDestination"] = "/sites/test/documentLibrary/C-Rejected-Updates-Needed"
   workflow.parameters["bpm:aproveDestination"] = "/sites/test/documentLibrary/D-Final-Document"
   workflow.parameters["sendEmailNotifications"] = true;
   return workflow.execute(document);
}

function main()
{
   var name = document.name;
   var siteName = document.siteShortName;
  
   if (siteName == null)
   {
      if (logger.isLoggingEnabled())
         logger.log("Did not start workflow as the document named " + name + " is not located within a site.");
        
      return;
   }
  
   var reviewGroup = "GROUP_site_" + siteName + "_SiteManager";

   // make sure the group exists
   var group = people.getGroup(reviewGroup);
   if (group != null)
   {
      if (logger.isLoggingEnabled())
         logger.log("Starting pooled review and approve workflow for document named " + name + " assigned to group " + reviewGroup);

      startWorkflow(reviewGroup);

      if (logger.isLoggingEnabled())
         logger.log("Started pooled review and approve workflow for document named " + name + " assigned to group " + reviewGroup);
   }
   else if (logger.isLoggingEnabled())
   {
      logger.log("Did not start workflow as the group " + reviewGroup + " could not be found.");
   }
}

main();


PROCESS DEFINITION

<?xml version="1.0" encoding="utf-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:parallelgroupreview">
  <swimlane name="initiator"></swimlane>
  <start-state name="start">
    <task name="wf:submitGroupReviewTask" swimlane="initiator" />
    <transition name="" to="startreview" />
  </start-state>
  <node name="startreview">
    <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
      <foreach>#{people.getMembers(bpm_assignees)}</foreach>
      <var>reviewer</var>
    </action>
    <event type="node-enter">
      <script>
        <variable name="wf_approveCount" access="write" />
        <expression>
                    wf_approveCount = 0;
                </expression>
      </script>
    </event>
    <transition name="review" to="review" />
  </node>
  <task-node name="review">
    <task name="wf:reviewTask">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
        <actor>#{reviewer}</actor>
      </assignment>
      <event type="task-create">
        <script>
                    if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                    if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                </script>
      </event>
    </task>
    <transition name="approve" to="endreview">
      <script>
        <variable name="wf_approveCount" access="read,write" />
        <expression>
                    wf_approveCount = wf_approveCount +1;
                 </expression>
      </script>
    </transition>
    <transition name="reject" to="endreview" />
  </task-node>
  <join name="endreview">
    <transition to="isapproved" />
  </join>
  <decision name="isapproved">
    <event type="node-enter">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
        <script>
          <variable name="wf_reviewerCount" access="write" />
          <expression>people.getMembers(bpm_assignees).length;</expression>
        </script>
      </action>
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
        <script>
          <variable name="wf_requiredPercent" access="write" />
          <expression>wf_requiredPercent = wf_requiredApprovePercent;</expression>
        </script>
      </action>
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
        <script>
          <variable name="wf_actualPercent" access="write" />
          <expression>wf_actualPercent = ((wf_approveCount * 100) / people.getMembers(bpm_groupAssignee).length);</expression>
        </script>
      </action>
    </event>
    <transition name="reject" to="rejected" />
    <transition name="approve" to="approved">
      <condition>#{wf_actualPercent &gt;= wf_requiredApprovePercent}</condition>
    </transition>
  </decision>
  <task-node name="rejected">
    <task name="wf:rejectedParallelTask" swimlane="initiator" />
    <transition to="end">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
        <script>
               var dest = companyhome.childByNamePath(bpm_rejectDestination);
               for (var i = 0; i &lt; bpm_package.children.length; i++){
                  bpm_package.children.move(dest);
               }
           </script>
      </action>
    </transition>
  </task-node>
  <task-node name="approved">
    <task name="wf:approvedParallelTask" swimlane="initiator" />
    <transition to="end">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
        <script>
               var dest = companyhome.childByNamePath(bpm_aproveDestination);
               for (var i = 0; i &lt; bpm_package.children.length; i++){
                  bpm_package.children.move(dest);
               }
           </script>
      </action>
    </transition>
  </task-node>
  <end-state name="end" />
</process-definition>


LOG FILE
Is attached: catalina-daemon.txt

Attachments

Outcomes