Customization of existing workflow to use e-mail notifications

Alfresco provides an inbuilt Web Site Submission workflow to be associated with the web project. If you want to make change in the existing workflow, following are the location of the files to make the changes.

  1. The Process Definition file is present in the specified location:
    <install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/workflow/submit_processdefinition.xml.
    
  2. The Task Model file is also present at same location:
    <install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/workflow/wcmWorkflowModel.xml.
    
  3. The Resource Bundle is also present at same location:
    <install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/workflow/wcm-workflow-messages.properties.
    
  4. The Spring Context file, which is used to load model, Process Definition, and Resource Bundle is present at the location:
    <install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/bootstrap-context.xml.
    
  5. The Alfresco Explorer Dialog is located at:
    <install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/web-client-config-properties.xml.
    

Consider a case where you want to add an e-mail notification at the submission of content. It is easy to customize the workflow by adding the following code snippet that is highlighted:

<task name="wcmwf:submittedTask" swimlane="initiator">
<timer duedate="5 seconds" transition="onsubmit">
<action class= "org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
logger.log("WCM Submit Process: Triggering submit for " + bpm_workflowDescription);
</script>
</action>
</timer>
<event type="task-end">
<script>
<variable name="submitfailed" access="write"/>
<expression>submitfailed = false;</expression>
</script>
<action class= "org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
logger.log("WCM Submit Process: Start submit for " + bpm_workflowDescription + " (by " + person.properties.userName + ")");
</script>
</action>
<action class= "org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
var mail = actions.create("mail");
mail.parameters.to = initiator.properties.email;
mail.parameters.subject = "Submit Task " + bpm_workflowDescription;
mail.parameters.from = person.properties.email;
mail.parameters.text = "It's done";
mail.execute(bpm_package);
</script>
</action>
<action class= "org.alfresco.repo.avm.wf.AVMSubmitPackageHandler"/>
<action class="org.alfresco.repo.avm.wf.AVMDeployHandler"/>
<action class= "org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
logger.log("WCM Submit Process: End submit for " + bpm_workflowDescription + " (by " + person.properties.userName + ")");
</script>
</action>
</event>
</task>

Deploy the Process Definition using a dynamic approach and test the workflow.

If you want to deploy changes manually, you have to make changes in the bootstrap-context.xml file as mentioned previously in the fourth point.

<props>
<!-- WCM workflow definition -->
<prop key="engineId">jbpm</prop>
<prop key="location">
alfresco/workflow/submit_processdefinition.xml</prop>
<prop key="mimetype">text/xml</prop>
<prop key="redeploy">true</prop>
</props>

You should receive an e-mail notification at the submission of content to the Staging box.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset