Defining Worklists and Scripts
Defining Worklists
Some users need notification of work that needs to be completed. For example, in the CMF default workflow, users with the Reviewer role need to be told when there are items pending review, so they can visit them and either publish or reject them.
One way to accomplish this is with worklists. Worklists add links to users' actions box when there are items in a certain state. The CMF default workflow supplies one worklist. It shows the Pending Review link to reviewers when there are items they are allowed to review.
After creating a worklist, enter the name of the state it matches. Use a guard condition to make only certain users see it. Also enter the name and URL of the link to be displayed.
Defining Scripts
You may need to perform actions like sending an email or invoking another workflow when users execute specific transitions. You can do this by writing scripts. Scripts can be any Zope object, but Scripts (Python) are most likely the best choice.
Scripts are passed one parameter, the state_change object of a workflow expression. Remember that your script is executed with the permissions of the user who invokes the transition, rather than your own permissions, unless you give the script proxy roles.
Once a script is in the Scripts container of a workflow you can visit a transition and select the script to be executed. The script will be executed before the state change and before variables are updated. It can raise exceptions to veto the action or an ObjectMoved or ObjectDeleted exception to tell the workflow that the object has moved or has been deleted.