AnsweredAssumed Answered

Workflow Script - aproveDestination

Question asked by eidan on Jul 16, 2018

Hello everybody,

I'm very very very new to Alfresco! 


I have been reading different post about how to do a workflow, execution script ....

 

With the following workflow.js I can execute the workflow correctly but when the document is approved it does not deposit it in the corresponding folder.

 

I have looked at the tomcat logs and I do not get an error.

Can someone tell me what I'm doing wrong?

 

Thank you very much!

 

 

function startWorkflow(assigneeGroup)
{
    var workflow = actions.create("start-workflow");
    document.addTag("Pendiente de aprobación");
    workflow.parameters.workflowName = "activiti$activitiReviewPooled";
    workflow.parameters["bpm:workflowDescription"] = "Ruego revisar y aprobar " + document.name;
    workflow.parameters["bpm:groupAssignee"] = people.getGroup( "GROUP_Aprobadores");
    var futureDate = new Date();
    futureDate.setDate(futureDate.getDate() + 1);
    workflow.parameters["bpm:workflowDueDate"] = futureDate;
    workflow.parameters["bpm:aproveDestination"] = "/Sitios/productos/documentLibrary/Aprobados";
    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();

Outcomes