What is workflow?
Workflow is an electronic routing of documents from one authorized person to another. A document does not become visible to the general public unless it’s approved by an authority. In large organizations, work is not managed by individuals but by te ams. So it is important to release the document through a proper channel.
In Alfresco business process is defined using the process definition. Process definition describes the states (steps) and transitions (choices) of a workflow. A step is a task which may be performed by a human- or system-based. Human steps create and assign tasks to users. System steps perform some kind of operation against the Alfresco repository.
In Open Source alfresco 2 categories of business process can be defined using jbpm those are Parallel and Serial workflow.
Parallel Workflow Process:
When files are submitted to a review workflow process, the files are reviewed by a set of approvers specified for the workflow process. in a parallel review workflow process, all approvers review the submitted files or request at the same time. The number of approvals or rejections for a completed approval or rejection is set in the Workflow tab of the folder or Library Properties window.
Serial Workflow Process:
When files are submitted to a review workflow process, the files are reviewed by a set of approvers specified for the workflow process. In a serial review workflow process, each approver reviews the submitted files or request in turn, one approver at a time. All reviewers must approve the request to complete the approval process; a single rejection ends the review process, and results in the request being rejected.
Steps to create Serial Workflow process:
Consider a scenario where generalized workflow is required in which a documents are sent for review sequentially and the number of reviewers varies ie from 1 and more.
Example: Initiator initiates the workflow and selects 3 reviewers. Task will go to each reviewers sequentially based on the previous reviewers decision. Each reviewer will have option of approve and reject. Approve will send the document to another reviewer and reject will send it to the previous reviewer if applicable otherwise to the initiator. Once everybody reviews the document task comes back to the initiator for final approval.
Key points in above scenario:
- No of reviewers not fixed.
- No of document not fixed.
- Option to be provided for selecting multiple reviewers in the initiator screen.
Steps to implement Serial workflow:
1. Create Process Definition
There are two ways of building the process definition (as dictated by JBoss jBPM):
- By hand i.e. create a jPDL xml document
- By designer i.e. use a tool to generate the jPDL xml document (or process archive)
| <?xml version=”1.0″ encoding=”UTF-8″?><process-definition xmlns=”urn:jbpm.org:jpdl-3.1″ name=”CustomReviewProcess”>
<swimlane name=”initiator” /> <start-state name=”start”> <task name=”ncm:startTask” description=”Submit Serial Review Task” swimlane=”initiator”/> <event type=”node-leave”> <script> <variable name=”approveCount” access=”write”/> <expression>approveCount = 0;</expression> </script> </event> <transition name=”Send For Review” to=”review”></transition> </start-state> <task-node name=”review”> <task name=”wf:reviewTask” > <assignment  class=”org.alfresco.repo.workflow.jbpm.AlfrescoAssignment”> <actor>#{bpm_assignees.get(approveCount)}</actor> </assignment> <event type=”task-create”> <script>System.out.println(”–Task—–first_review——”+approveCount+”—reviewerCount–”+reviewerCount);</script> <script> if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate; if (bpm_workflowPriority != void)  taskInstance.priority = bpm_workflowPriority; </script> </event> </task> <event type=”node-enter”> <script> <variable name=”reviewerCount”  access=”write”></variable> <expression>reviewerCount = bpm_assignees.size();</expression> </script> </event> <transition name=”Approved” to=”isLast”> <script> <variable name=”approveCount” access=”write”/> <expression>approveCount =approveCount+1 ;</expression> </script> </transition> <transition name=”Reject” to=”isFirst”> <script> <variable name=”approveCount” access=”write”/> <expression>approveCount =approveCount – 1 ;</expression> </script> </transition> </task-node> <decision name=”isLast”> <transition name=”No” to=”review”> <condition> #{approveCount < reviewerCount}</condition> </transition> <transition name=”Yes” to=”FinalSubmit”> <condition> #{approveCount == reviewerCount}</condition> </transition> </decision> <end-state name=”end” /> <decision name=”isFirst”> <transition name=”No” to=”review”> </transition> <transition name=”Yes” to=”re_submit”> <condition> #{approveCount < 0 }</condition> </transition> </decision> <task-node name=”re_submit”> <task name=”wf:reviewTask” swimlane=”initiator” > <event type=”task-create”> <script>System.out.println(”–Task—–re_submit——”+approveCount+”—reviewerCount–”+reviewerCount);</script> <script> if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate; if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority; </script> </event> </task> <transition name=”ReSubmit” to=”review”> <script> <variable name=”approveCount” access=”write”/> <expression>approveCount =0 ;</expression> </script> </transition> <transition name=”Finish” to=”end”></transition> </task-node> <task-node name=”FinalSubmit” > <task name=”wf:reviewTask” swimlane=”initiator” > </task> <transition name=”Finish” to=”end”></transition> </task-node> </process-definition> |
2. Deploy the process definition in Alfresco Server.
3. Create Task Model for the workflow:
For each Task in the process definition (as defined by <task> elements in jPDL) it is possible to associate a Task description. The description specifies the information that may be attached to a Task i.e. properties (name and datatype) and associations (name and type of associated object). A user may view and edit this information in the Task dialog within the Alfresco Web Client.
4. Deploy the Task Model in Alfresco Server.
5. Configure the Web client
Go to the location <<tomcat_directory>>\shared\classes\alfresco\extension and add the following line of code in the web-client-config-custom.xml.
| <config evaluator=”node-type” condition=”ncm:startTask” replace=”true”> <property-sheet>
<separator name=”sep1″ display-label-id=”general” component-generator=”HeaderSeparatorGenerator” /> <show-property name=”bpm:workflowDescription” component-generator=”TextAreaGenerator” /> <show-property name=”bpm:workflowPriority” display-label-id=”wf_review_priority” /> <show-property name=”bpm:workflowDueDate” display-label-id=”wf_review_due_date” /> <separator name=”sep2″ display-label-id=”users_and_roles” component-generator=”HeaderSeparatorGenerator” /> <show-association name=”bpm:assignees” display-label-id=”wf_reviewers” /> <separator name=”sep3″ display-label-id=”wf_review_options” component-generator=”HeaderSeparatorGenerator” /> <separator name=”sep2″ display-label-id=”wf_reviewers” component-generator=”HeaderSeparatorGenerator” /> <show-property name=”bpm:priority” read-only=”true” /> <separator name=”sep3″ display-label-id=”wf_review_options” component-generator=”HeaderSeparatorGenerator” /> <show-association name=”bpm:package” read-only=”true”/> </property-sheet> <condition-handlers> <show-association name=”bpm:package” read-only=”true”/> </condition-handlers> </config> |
6. Upload the updated web-client-config-custom.xml file at location Company Home > Data Dictionary > Web Client Extension.
7. Test the Workflow
Custom workflow definitions may be tested using one of the following methods:
- Start the Alfresco Server and test via the Alfresco Web Client
- Use the Workflow Console to interactively step through workflows

