AnsweredAssumed Answered

Automation of pooled review workflow.

Question asked by soumyakarmakar on Dec 12, 2012
Latest reply on Dec 13, 2012 by soumyakarmakar
Hi ,

I have created two spaces pending approval and publish.
Requirement is to automated pooled review where ever a document is upload in pending approval.
So, I am using a sample script and using in applying rule in the pending approval space.
But as required the pooled review workflow is not triggered when document is uploaded in the pending approval.

Below I have mentioned sample script been used as rule in pending approval space.
#####################################################

function startWorkflow(assigneeGroup)
{
   var workflow = actions.create("start-workflow");
   workflow.parameters.workflowName = "activiti$activitiReviewPooled";
   workflow.parameters["bpm:workflowDescription"] = "Please review " + document.name;
   workflow.parameters["bpm:groupAssignee"] =people.getGroup( assigneeGroup );;
   var futureDate = new Date();
   futureDate.setDate(futureDate.getDate() + 7);
   workflow.parameters["bpm:workflowDueDate"] = futureDate;
   return workflow.execute(document);
}

function main()
{
   var name = document.name;
   var siteName = document.siteShortName;
  
  
  
   var reviewGroup = "GROUP_test" + siteName;

   // 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();

###################################

Thanks,
Som.

Outcomes