Timer in Alfresco JBPM Workflow

Timers are very powerful tool within JBPM workflow engine. It allows us to define certain rules or rather, time bound flow within workflow.

For instance, if there is a requirement where if the reviewer does not take any action for a particular period of time, then the task should be considered as rejected or the system should automatically send an email notification to all allied users.

A workflow timer provides the ability to trigger an action or transition within a workflow at a specified future time (absolute or relative to the entry of a node in the workflow). Timers are useful for implementing escalation procedures (e.g. user A has not completed task B, therefore notify user C) and delayed processing (e.g. submit content to Web Site in a week’s time).

One step further then above case where we are sending only email notification we can also set auto transition based on timer. So, that if action is not taken on task in specific period of time it will be auto approved or auto rejected based on settings.

Timer can be easily used just by injecting piece of code within process definition file of workflow.

Here is the sample

<task-node name="review">

                                <task name="wf:review">                                         

                                                <timer name="validationTimer" duedate="5 minutes" transition="reject">

                                                                <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">

                                                                                <script>

                                                                                                logger.log("Timer expired");

                                                                                </script>

                                                                </action>

                                                </timer>

                                </task>

                                <transition to="approved" name="approve"></transition>

                                <transition to="rejected" name="reject"></transition>

</task-node>
  • duedate It is relative time (e.g. 4 days”) or an absolute date object It can also set from a workflow variable like “wf_dueDate”
  • the timer can have an associated action which is executed when the timer is triggered
  • the timer can have an associated transition which is followed when the timer is triggered here transition is “reject”
  • If the task is explicitly exited before the timer is triggered, the timer is destroyed. So that means if user act on review task and approve or reject task before timer is expired it will automatically destroyed.

This timer is set for 5 minutes (just for testing) if user does not approve or reject within 5 minutes then engine will automatically transit to rejected task node.

NOTE: Alfresco server has to be running in order to make it work.

Within “Script” tags you can have email sending code. I had explained how to use alfresco javascript within workflow process definition file to send email.

Reference:

http://docs.jboss.org/jbpm/v5.1/userguide/ch05.html

https://wiki.alfresco.com/wiki/WorkflowAdministration

Looking for quality Alfresco Web Hosting ? Look no further than Arvixe Web Hosting !

Tags: , , , , , , , , , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

Leave a Reply

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


× 7 = 21

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>