AnsweredAssumed Answered

Attach Multiple Files in a Workflow using via Rule using JavaScript

Question asked by ruchin78 on Jan 13, 2016
Latest reply on Jan 18, 2016 by ruchin78
I want to create a workflow using JavaScript with multiple files attached in the workflow for review.

Below code works only for any single file added to the alfresco.

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"] = assigneeGroup;
    var futureDate = new Date();
    futureDate.setDate(futureDate.getDate() + 7);
    workflow.parameters["bpm:workflowDueDate"] = futureDate;
   workflow.document
    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;

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

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


Please Help

Outcomes