Alfresco Activiti Workflow Automation
Last time I blogged about how to start a workflow explicitly via webscript. In our Canopy solution, if desired, the workflow can be started automatically upon a document submission from Drupal to Alfresco as well. The document upload is usually done via CMIS Alfresco. This approach will enable the workflow automation between CMIS client such as Drupal, Joomla etc and Alfresco.
How to set up a rule inside Alfresco SharePlease check out an example of rule for workflow.
How to start a workflow programmaticallyPlease install the following script run_js.wf in Alfresco's /Data Dictionary/scripts. The script will start Alfresco's out of box Review and Approve workflow when the new document is uploaded to Alfresco. The highlights are:
- Read a custom property "canopy:reviewer" via document.properties.The value of "canopy:reviewer" should be set by CMIS client upon document upload.
var workflow = actions.create("start-workflow"); workflow.parameters.workflowName = "activiti$activitiReview"; workflow.parameters["bpm:workflowDescription"] = "Please assign approvers for "+document.name; var reviewer=document.properties["canopy:reviewer"]; logger.debug("canopy:reviewer="+reviewer); workflow.parameters['bpm:assignee']=people.getPerson(reviewer); workflow.parameters["sendEMailNotifications"] = false; workflow.execute(document);