Warning

This document hasn't been checked for compatibility with current versions of Plone. Use at your own risk.

Defining Workflow States

by Jon Stahl last modified Dec 30, 2008 03:05 PM
Using workflow states you can add state to your content that is specific to your business process.

CMF comes with a default workflow with three states: private, pending, and published. In the default configuration, all content in the CMF is set to operate in that workflow. When an object is in the private state, only the user who created it and site managers can view and change it. The user is provided with a link to "submit" the content, which puts it in the pending state. Then a user with the "reviewer" role is given the opportunity to either publish or reject the submission, which moves the content object to either the published or private state.

workflow-diagram.gif

Illustration 1: A Simple Example State Machine


Your business process will most likely require a different set of states. For example, a workflow could naturally model the process of ratifying a bill in a state legislature. You could start by creating a Private state to be used while the author is creating a new bill, a Public state used before voting, a Voting state during which time legislators are allowed to cast their votes, a Final Review state which gives the executive branch time to review it, a Vetoed state, and a Passed state. (See Illustration 1.)

workflow-swimlanes.gif

Illustration 2: Using "Swim Lanes" in Designing a Workflow


One good way to determine what states you need in your business process is to first draw a diagram with "swim lanes". (See Illustration 2.) Draw a diagram with each relevant user role at the head of a column, then draw dotted lines between the columns. In the legislature example, the roles might be Owner, Public, Senator, and President. Draw a state diagram that shows the flow of your content (in the example, a bill) between the different users. Then create a workflow state for each bubble you draw in your diagram. (See Illustrations 3 and 4.)


A technical note: changing the workflow state of an object does not move it to a different location or add Python attributes to the object. Instead, it asks the workflow tool to set the workflow state of the object and the workflow tool can choose how the state will be stored. The default implementation of the workflow tool stores the workflow state in the workflow_history attribute of CMF content objects.

Add a Workflow

Illustration 3: Add a workflow by clicking the "Add Workflow" button in the portal_workflow tool.




Add a State

Illustration 4: Adding a state


Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.