Advanced Workflow Trinity in Drupal

Submitted by JacobSingh on April 24, 2008 - 6:17am.

The workflow trinity: States, Owners and Rules

Amnesty International has 400+ employees in their London office who work in various capacities from research, to advocacy, to marketing and development of the organization. Their web and press divisions (primary admins of the website) need to create stories and press releases with input from all of these employees. As a result, workflow became a very important part of this project.

Modules used:

Specific Issues

Need for accountability at all steps in the process

The standard workflow module allows for the definition of arbitrary states and logging, however it does not provide any ownership of those states. In a small website with three or four moderators, this is fine. Stories placed in the "review" state will end up in a queue via views/workflow integration, and moderators will pick through them, moving their states as needed. In our case, each node may have a different fact checker, editor, Sr. editor and translation coordinator who will be responsible for pushing it through the process.

Solution:

We wrote a custom module called Workflow_owner (now contributed back to drupal.org in beta). Workflow Owner creates a new fieldset / tab when editing a node which allows the user to assign ownership to each workflow state.

This module also has views integration, so when a user goes to their user page they see a new tab for workflows owned:

In addition, one can set a default owner for each state:



Need for complex notification and workflow modification rules

But this doesn't solve the problem of notifying owners when they become responsible. Not everyone is tied to their computer refreshing this page, so we had to develop a solution for this. We contacted Fago soon after workflow_ng was released in beta, and we decided to gamble on this excellent, nay inspired module.

Solution:

Workflow-ng is a great way to fire off complex actions and let the user easilly configure their events and parameters, but it lacked support for workflow based events. We added this in the workflow_workflow_ng module and through the use of tokens which we added to workflow and workflow_owner. The net result is that a user may specify that on a the event "workflow changed", where the old state is "draft" and the new state is "review", send an email to the owner of the review state, and include in it a link to the article in question. See this short screen cast of how the workflow_ng rules are configured (3min):

Note: I apologize for the shoddy editing, it's my first time with Camtasia, and I'm still getting used to it :) Please comment if it is really unclear.

Then, when we change the workflow state, the event is fired:

Conclusion:

Workflow software will ultimately not enforce publishing procedures in a media organization, however, it is an excellent tool for keeping records of previous activity, and for facilitating communication among staff.

While much of this code is in beta still for the community as the Amnesty implementation is further customized and tested, it would be great to see people try this setup out and start submitting patches / ideas.

Future enhancements could include:

  • More Worfklow-ng conditions
  • Worfklow-ng actions for changing state / owner
  • i18n support for translation workflow

If anyone has any questions or wants to follow up with me, you can do so here or at this same article on my personal site Worfklows for Drupal