cancel
Showing results for 
Search instead for 
Did you mean: 

Script location and due date

e-no91
Champ in-the-making
Champ in-the-making
Which one is the java script file for folder's simple workflow (the Approve, Reject one)?
And is it possible to set a due date on files that enter a folder, so when a file is in the folder for example, 3 days, an email is sent to the site manager?

Thank you in advance!
6 REPLIES 6

romschn
Star Collaborator
Star Collaborator
If you want to go for a due date and notification email functionality then you should probably go for custom advanced workflow with timers. This way you will be able to send email notifications once the due date is passed.

e-no91
Champ in-the-making
Champ in-the-making
But if I am to use custom advanced workflow, I have to specify the file/content from  the very beginning, right? I'm trying to set it as a folder rule instead, is it possible? So far I've searched I don't found what I want…

mrmike
Champ in-the-making
Champ in-the-making
I believe you would want to create a custom workflow using the accept/reject workflow as your reference- this workflow is located at C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\workflow\review.bpmn20.xml. You can look also look at C:\Alfresco\tomcat\shared\classes\alfresco\extension\activiti-adhoc-timer.bpmn20.xml.sample.

You can then setup a rule on your drop folder to fire when new content enters the folder.

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "***YOUR CREATED WORKFLOW***";
if(workflow)
{
workflow.parameters["bpm:workflowDescription"]="Some description";
workflow.parameters["bpm:description"]="This workflow was created by rule XXXX";
                  workflow.parameters["bpm:groupAssignee"]=people.getGroup("GROUP_TestGroup");
or you can do it for person
workflow.parameters["bpm:assignee"]=people.getPerson("testUser");;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 3);   
                        workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);
}

*This snippet is untested

e-no91
Champ in-the-making
Champ in-the-making
Thank you.
So, in short, to make this work, I should make a custom workflow in xml, and store it in that workflow folder,
and write that javascript snippet to call the xml workflow?

e-no91
Champ in-the-making
Champ in-the-making
I've tried changing the start-pooled-review-workflow.js directly, only changing the day and
var reviewGroup = "GROUP_group name"

There are no errors from the logs, but the task either shows up or not, to everyone, and always written as unassigned, no due date, and no owner.

Here is the full js code
function startWorkflow(assigneeGroup)
{
    var workflow = actions.create("start-workflow");
    workflow.parameters.workflowName = "activiti$activitiReviewPooled";
    workflow.parameters["bpm:workflowDescription"] = "Sila lakukan semakan ke atas dokumen " + document.name;
    workflow.parameters["bpm:groupAssignee"] = assigneeGroup;
    var futureDate = new Date();
    futureDate.setDate(futureDate.getDate() + 3);
    workflow.parameters["bpm:workflowDueDate"] = futureDate;
    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_URUSETIA SEKRETARIAT";

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

I've tried replacing some part of my code with your snippet, the same thing occured.

e-no91
Champ in-the-making
Champ in-the-making
This xml helps a lot~

As for the xml, all I did was just copy paste it on the same folder and rename it, its fine right? I've been trying but sometimes far alfresco will crash..
I've been referring to this post https://forums.alfresco.com/forum/developer-discussions/workflow/review-approve-activiti-process-071... and the xml is said to be uploaded on admin site, which I cannot find in my admin site.
And, where can I get the model file?
So I only have to edit 2 files : bpmn20.xml and share-config-custom.xml, and nothing to the processdefinition.xml?