Workflow Script - aproveDestination

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

Workflow Script - aproveDestination

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();
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
4 Replies
Highlighted
Member II

Re: Workflow Script - aproveDestination

Hi eidan,

  have you found a solution for your issue ?

I've raised an issue very similar to your case in this post.

Cheers,

Enrico.

Highlighted
Advanced II

Re: Workflow Script - aproveDestination

Hello.

Where did you get the parameter "bpm:aproveDestination"?

That one does not even exist in the out of the box content model?

Simply adding it will not make the workflow work the way you want to to work.

Highlighted
Member II

Re: Workflow Script - aproveDestination

Hi Douglas,

  I suppose that parameter has been copied from other examples found around Internet.

Now the point is: how do "folder move on approve" step using out-of-the-box building blocks ?

In case a customization is required, how we can manage this change within standard workflow ?

Any help will be appreciated.

Regards,

Enrico.

Highlighted
Advanced II

Re: Workflow Script - aproveDestination

That is what I thought.

It is not going to work the way you want it to work, and there is nothing you can do within the standard workflows.

In order to achieve the result you need, you will have to create custom workflows to deal with that for you.

You can get all the information you need to develop these custom workflows in the following tutorial: https://ecmarchitect.com/alfresco-developer-series-tutorials/workflow/tutorial/tutorial.html