Drupal 6 Workflow Module: Documentation

Submitted by dontai on Wed, 04/01/2009 - 18:41

I've been doing workflow applications going on a decade now using Domino Notes. It is very sophisticated and secure but administratively very heavy. I was intrigued with Drupal's Workflow module. Though the module is at first confusing, it seems to work quite well.

 

Firstly there is no documentation, so you're pretty much on your own. I tried to google for anything to help me out, but there's not much online. It seems like many people have been asking as well. In order to remedy this I've written this blog entry. Though not complete, I hope this will get others on the way to using this great module.

 

Installation is simple and standard. Download and extract to your sites/all/modules directory. Install the module from your admin panel. There are no necessary prerequisite modules. You'll need to do permissions for the module as well as configure your workflow. Allow authenticated users to create a document but not to administer workflow.

The Workflow module allows you to do workflow on a specific document type. For example, I wanted to add a workflow process to a story document. My story document can be submitted by an authenticated user, then someone with editor access can approve it. Until approval, the document should not be available to others for viewing. It's as simple a workflow as possible

My Example

My workflow should be as follows:

  1. an authenticated user adds a document, which starts the workflow. It is not visible to the public. From its origin the document moves to a workflow state I call "story approve".
  2. Someone else with a role of editor can then approve the document, changing its state to "submit". The document is now available to the public.

 

Define Drupal Roles

You need to configure different roles for your workflow and define them in Drupal. These can be different from editor and administrator. All roles need proper permissions for the workflow module. Permissions for the "workflow tab" allow a user to see the state of workflow of specific documents, though they may not have permission to change the workflow.

Defining Workflow Steps

Workflow allows you to define a process or series of steps necessary to get to your final destination. Each step requires some action and approval before moving to the next step. For a simple example, in order to eat an apple the steps required include: purchase, wash, eat. Each of these steps needs to be defined, and each step requires someone to do the step and to approve it.

The workflow module allows you to create as many workflow steps (or states) as possible. You can configure which roles can move the document from one workflow step to another. The original document submitter must have the authority to move his document to at least the first workflow step. This is a set rule of the module. Workflow steps are weighted from 10 to -10, the heavier the number, the later the workflow step. This allows you to put workflow steps in the proper order. I put my last step, "submit" as 10, because after this step the document is published and is public. The workflow step "story approve" was weighted at 0, and therefore a step above or prior to workflow step "submit".

A "Workflow Summary" tab will be added to your website near the administration tab. This tab will allow you to see your document and its workflow step.

Defining Roles to move from Workflow Step to Step

For each workflow step you add, you need to define which roles can move your document from one step to the next. In my case I allowed the author to move the document to the "Story submit" workflow step, but only an editor role can move the document to the "submit" step, where it is published. Without clear rules about workflow steps and approvers, workflow can get pretty complicated.

Defining Who can see the Document during the Workflow

For each workflow step you add, the Workflow module allows you to configure who can view, edit or delete the document. This is where you can hide the document from the public. Of course the last workflow step, which by default is called "submit", you need to allow people to see it.

Wrapup

The Workflow module is compact and very usable. I would have appreciated having better documentation, but did figure everything out in the end. There is more to the Workflow module than I know, so more learning is required, but this documentation will get you on your way to workflowing.