Contents

Introduction

I've finally got around to documenting how to create / use workflow in the Quest "product". Our workflow branched from the old OpenACS workflow package acs-workflow long ago, with many hacks for various projects along the way.

Creating a test workflow

Test a workflow without creating a ticket

What happens when the workflow moves?

  1. The user clicks a button in the action panel.
  2. Each button is a submit with the name "action.attributes.attribute name. Pressing one will submit the form to the current page (the task page).
  3. task.tcl processes the action array, creating another array called arributes. Each button has an element in attributes set to 't' or 'f' to indicate which was pressed.
  4. task.tcl calls wf_task_action
  5. wf_task_action:
    • calls workflow_case.begin_task_action
    • updates acs_attributes
    • updates assignments
    • calls workflow_case.end_task_action
    • notifies watchers

How do I return a message to the user when a guard isn't satisfied?

Just raise an application exception in the guard with the text you want displayed. The workflow will catch the exception and show the message.

Troubleshooting

Why doesn't my button show on the task page?

To add a button, you must have the following:

What moves the workflow?

If you look at workflow_case.fire_transition_internal you'll see it consumes tokens for the input places for the current transition and creates new ones at the output places where the guard is satisfied. This is what "moves" the workflow. (This might be done elsewhere - I haven't checked yet).

Where is a case in the workflow?

Go to workflow admin -> your workflow -> x cases total There is a breakdown of cases in places. Click on the relevant one for your case. Select your case from the list. This shows the case details, including a Graphviz representation of the workflow with the current position in it highlighted in blue (Process State panel).

When a task is created it's state is 'enabled'. There will also be a token in the place before the transition the task is for, whose state is 'free'. There is a Quest hack that automatically starts a task for a user when they click on the task in their inbox. Starting a task puts it into a state of 'started', and locks the token at it's "in" place. If a token's state is locked, the process state image highlights the transition. If a token's state is free, the process state image highlights the place.

Automatic transitions

These are used for parts of the workflow that depend on your own callbacks when you want to direct the workflow automatically. If you want your worklfow to move automatically sometimes, but not others you shouldn't make the transition auto because it will always fire. If no guards are satisfied no new tokens will be created and there will be no active tasks on the workflow.

Glossary

Case
A case is an instance of a workflow. Stored in WF_CASES, identified by CASE_ID. Usually a case is tied to a ticket by the column WF_CASES.OBJECT_ID.
Workflow
A definition of a business process using places, transitions, attributes and roles.