Book Image

Alfresco Developer Guide

Book Image

Alfresco Developer Guide

Overview of this book

Table of Contents (17 chapters)
Alfresco Developer Guide
Credits
About the Author
About the Reviewers
Preface
Index

Adding Logic to Workflows with Actions and Process Variables


So far you've seen that a process can be modeled as a collection of nodes connected via paths or transitions. A common requirement is to be able to execute some code or business logic at certain points within the process. For example, maybe you want to send an email or want to increment a counter that keeps track of how many times a node has been executed. Actions are the hooks that make this happen. (Yes, this is yet another use for the word "action" within Alfresco. But, to be fair, this one occurs within the context of jBPM.)

What triggers an action? As a token propagates through the workflow, it fires events. Examples include things such as entering a node, leaving a node, or following a transition.

Actions can be a Beanshell expression or a Java class. In the context of Alfresco, actions can also be written using JavaScript, which can make use of the Alfresco JavaScript API.

Storing Data in Process Variables

Often, there is metadata...