Monday, October 25, 2010

JBPM Workflow in Alfresco Share 3.4a community release

There's some interesting improvements available for Workflow in the Alfresco 3.4a Share community release.  Alfresco community downloads are available here.  

Gavin Cornwell from Alfresco has updated the Alfresco wiki with information about 3.4 Share workflow.

Starting a Workflow in Share
Workflows can be started by clicking on the "Start Workflow" action links from either the document details page, from the actions along the right on an item row in the list of Document Library items, or from the select items menu which applies to all items selected in the Document Library page.

After clicking on that, the start-workflow page comes up.  It's a little bit sparse.  The main element is a button that lets you choose which workflow to assign from a popup list of all available Workflows that can be initiated.

The available workflows are those that have been registered with the JBPM engine.  The Alfresco wiki outlines the steps for adding a new custom workflow.  Once added, the new workflow automatically becomes available in this dropdown.  Prior to release 3.4 in Share, the workflow items that could be assigned in Share were hardcoded.

In the screenshot above we can see the new "Custom Lifecycle Review" workflow added using the code from the Alfresco wiki.

As an aside: The server-side Javascript file tomcat\webapps\share\WEB-INF\classes\site-webscripts\org\alfresco\components\workflow\workflow.lib.js that contains the code used on this page to query out the available workflows (getWorkflowDefinitions).

The list of scripts displayed are determined for the dropdown menu from the webscript:
Workflows can be filtered out from this list, for example, if you don't want to see WCM workflows.  These workflows are identified by the tag <hidden-workflows> in the tomcat\webapps\share\WEB-INF\classes\alfresco\share-config.xml file, and also in the wcmquickstart-share-config.xml file in that same directory.

Form for Starting and Assigning a Workflow

After you select one of the workflows in the list, the form to enter the parameters that define the workflow is displayed.  I didn't expect to see too much when I selected the new Custom Lifecycle workflow since I had not defined a form for it, but it wasn't too bad.  The layout wasn't great, but everything seemed to work OK, and assigning the workflow worked too.

We can customize the look of this form easily.  For example, by adding the following code to the tomcat\shared\classes\alfresco\web-extensions\share-config-custom.xml file, the layout can be changed.  (The file tomcat\shared\classes\alfresco\web-extension\share-config-custom.xml defined where form definitions and overrides can be placed.)

The important thing here is to match the name of the workflow correctly in the condition for identifying the form that will be matched to it, like condition="jbpm$wfl:lifecycleapproval" in the example below.

<config condition="jbpm$wfl:lifecycleapproval" evaluator="string-compare">
               <show id="bpm:workflowDescription">
               <show id="bpm:workflowDueDate">
               <show id="bpm:workflowPriority">
               <show id="bpm:assignee">
               <show id="packageItems">
               <set appearance="title" id="" label-id="workflow.set.general">
               <set appearance="" id="info" template="/org/alfresco/components/form/2-column-set.ftl">
               <set appearance="title" id="assignee" label-id="workflow.set.assignee">
               <set appearance="title" id="items" label-id="workflow.set.items">
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
               <field id="bpm:workflowDueDate" label-id="workflow.field.due" set="info">
               <field id="bpm:workflowPriority" label-id="workflow.field.priority" set="info">
                  <control template="/org/alfresco/components/form/controls/workflow/priority.ftl">
               <field id="bpm:assignee" label-id="workflow.field.reviewer" set="assignee">
               <field id="packageItems" set="items">

User Task and Started Workflow Lists

The uppermost Share navigation toolbar has been redesigned.  A "More" button is available which now includes links to user areas like "My Profile", "My Sites", and "My Content".  Links to two pages that are new to the 3.4 release are also included in this dropdown list: "My Tasks" and "Workflows I've Started".  We'll talk about these two new features in just a bit.

Also included in this dropdown list are links to administrative functions like "Application" settings, "Groups", "Users", and another new-for-3.4 capability, "Replication Jobs".  These are grouped together in the menu in a category called "Tools".  I think that I would prefer that these administrative tasks be broken out into their own menu, but this layout is still workable given the current set of features in Share.

The "My Tasks" page presents a nice summary of the outstanding tasks for the user.  Filters along the left let you quickly zoom in on a specific set of tasks if there are many in your list.

A similar page exists for the user to see the workflows that they've started.  Unfortunately though, once the 'Task Complete' task is done it is removed from the list.  It would be nice to be able to review the workflows that have completed.


  1. Thanks for this post. I gave this a try for a custom workflow, but my form definition only gets picked up when placed in share-config.xml, not share-config-custom.xml. When placed in share-config everything works as expected. Any thoughts on why it doesn't work from share-config-custom? I'm running 3.4a.

  2. Steve --
    Is the share-config-custom.xml file in the tomcat\shared\classes\alfresco\web-extension directory?
    That is working for me on community 3.4b.

  3. Yes, it is in web-extension. I guess I'll have to try 3.4b. Thanks

  4. I resolved this issue. I had a malformed tag in another part of share-config-custom which caused the problem. Once corrected, my form definition worked from within share-config-custom. Thanks

  5. Hi,

    Thanks for this amazing post related JBPM Workflow. I like your blog because i am interested in JBPM Community. I really enjoy reading most part of the article.