Integrating Workflow and Custom Forms in Alfresco

by | Nov 11, 2013 | Alfresco, Alfresco Development | 0 comments

Recently, while working with a client I went through the course of understanding their business processes.  What transpired was a fairly complex process.  It started out simple:


  1. Complete form, submit to manager.
  2. Manager reviews, either rejects for more information or accepts and forwards to departments.
  3. Each department then has to complete a checklist, in which the department may only complete their assigned checklist, but be able to view other department checklists.  Each checklist has a number of questions which may invoke an action.  If the question invokes an action, then the person filling out the checklist has to select a person to assign the action to.  This action should not be sent to the selected person until a later stage in the workflow.
  4. The workflow cannot proceed until each department completes their checklist.
  5. Some more steps ….
  6. On approval, all assigned actions are sent out to the appropriate people.
  7. Some more steps ….
  8. The workflow cannot complete until all assigned actions are completed by the assigned users.  Note: this could be hundreds of actions which need to be tracked!

Pretty basic stuff to implement, isn’t it?

I may have glossed over a few details.  The main driver behind this business process is the automation of the checklists.  Each checklist may vary in the responses to the questions being asked.  For example, in one checklist the answers may be “Yes|No|N/A|Unresolved”, while aanother checklist might be “New|Modified|Delete”.  As mentioned earlier clicking on an answer to the question may in fact trigger an action to be assigned to someone.  In fact, each answer could trigger an action, and each action may differ.

In order to accomplish the creation and handling of these checklists, we implemented custom datalists, services and forms.  The datalist allowed for the creation of the various questions with the appropriate answers.  The question also allowed for setting the trigger event, if any, for the various responses.  The form presents the questions to the user and groups them based upon the grouping setting and allows for the checking of the questions.  I should note than only one response is allowed.  It is conceivable, of course that multiple responses could be allowed.

Below is an example for a checklist showing all the properties and indicating if this is a trigger action.

Workflow-Checklists within Alfresco ECM

Data-checklists-within Alfresco


To tie the datalist and forms together, custom services were created.  The services took care of assembling the questions by their grouping (it anyone) and providing these to the form.  The service would also manage tracking the answers.  As an added bonus: the services were exposed to the webscripts tier to facilitate reporting against them.

Below is an example of a checklist


So now we have sucessfully created a checklist, but we still need to incorporate it into the workflow.  Seeing as custom forms are being used, it makes this a little more challenging to wrap these up within the workflow process.  Fortunately at Armedia, we are full of creative people, itching to solve problems.  And thankfully Alfresco is implemented in a way to cater for creative people:)

To integrate the workflow and the custom forms, this was achieved by implementing an alternative way to invoke the custom workflow/forms.  A simple dashlet was created to allow users who would be creating these workflows to start them from their Dashboard

Creating a New Workflow within Alfresco


This dashlet invoked some custom code which allows the custom form and the workflow to be “glued” together.  By taking this approach it has allowed  us to  custom logic (ie. making sure everything is completed correctly) before allowing the workflow buttons to be enabled.  As part of the business process it is important that the workflow not proceed until all conditions are met.  For example, if a checklist is completed but a question has been marked as “Unresolved” then the workflow should not proceed.

Below is a sample of the javascript which is used as the wrapper around the custom workflow and custom form.

* @namespace Alfresco.module
* @class Alfresco.module.MocWrapper
(function() {
    var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event, Element = YAHOO.util.Element, Bubbling = YAHOO.Bubbling, KeyListener = YAHOO.util.KeyListener

    nodeRef = "";

     * MocWrapper constructor.
     * @param htmlId {string} A unique id for this component
     * @return {Alfresco.module.MocWrapper} The Moc Wrapper  instance
     * @constructor
    Alfresco.module.MocWrapper = function(containerId, nodeRef) {, containerId, nodeRef);

        return this;

    YAHOO.extend(Alfresco.module.MocWrapper, Alfresco.module.FormWrapper, {

The downside to this approach means that the custom workflows cannot be started using the “Out of the Box” start workflow as we need to associate the custom form noderef with the workflow.  Seeing as this is version 1 of the solution, we had to leave something for the next release, to more seamlessly integrate the custom forms and workflow.

In the overview of the business process, I indicated that when completing the checklist, you may need to assign an action to someone.  Believe it or not, we have a service for this!  Each time an action is created it is associated with the checklist.  By doing this it allows the action to be tracked once it is eventually sent to the assigned user.

Below is an example of the actions that have been assigned during the checklist process

Automatic-Responsibilities assigned during Alfresco Workflow

The list of actions is visible from within the form.  Note that we track who assigned the action, who it is assigned to and what the status is.   As this is only an example, a real view would actually include many more actions.   Each column can be sorted to help the author of this workflow.  This will help in finding out which actions are completed and which ones are still in process.

Finally, to make all of these workflows available for users to access and view as a consumer a custom dashlet was created which users can place on their dashboard.  This dashlet shows all of the workflows that are currently in process and completed.


By clicking on the Workflow # the user is taken to the form where they can view all the details associated with it, like checklists, actions, documents.

There is more to this solution to talk about. However, I will leave that to future blog posts!


Need a bit more info on how Armedia can help you?

Feel free to schedule a 30-minute no-obligations meeting.


Submit a Comment

Your email address will not be published. Required fields are marked *