Item1828: Conditional transitions for WorkflowPlugin

pencil
Priority: Enhancement
Current State: Closed
Released In:
Target Release: n/a
Applies To: Extension
Component: WorkflowPlugin
Branches:
Reported By: DeanSpicer
Waiting For:
Last Change By: CrawfordCurrie
I coded another very small enhancement to the WorkflowPlugin. It allows me to do:

| MYSTATE | conditional action | %IF{"QuantityAccepted" then="MYNEXTSTATE" else=""}%| engineering, managers | |  |

such that the allowed next state list can make decisions based on the topic under control. The code change is actually very simple. I've attached the diff to Workflow.pm (Workflow.pm.diff) (it is generated against TWiki version of the WorkflowPlugin so it will have to be applied manually)

I needed to modify getActions() and getNextState()

Summary of changes are:
  • Expand macros on the NextState column then
  • only add transition to list of available actions if it is not empty.

-- DeanSpicer - 14 Jul 2009

This took a while to incorporate because there was no documentation, so I had to write some. Can you please check it, make sure I haven't made any obvious boo-boos? Here's what i wrote:

Content-sensitive workflows

Advanced Flows can be made sensitive to the content of the controlled topics. The 'Allow Edit' column in the state table, and the 'Next State' and 'Allowed' columns in the transition table, support the use of macros which are expanded when the topic is viewed. For example, you can use the META macro to pick up values for these fields from the form attached to the topic:

State table
| *State*             | *Allow Edit*                         | *Message* |
| WAITINGFORAPPROVAL  | %META{"formfield" name="MayModify"}% | This document is waiting for approval |
Transition Table
| *State*            | *Action* | *Next State*                             | *Allowed*                        |
| WAITINGFORAPPROVAL | approve  | %META{"formfield" name="ApprovedState"}% | %META{"formfield" name="MayApprove"}% |

You can also define other macros starting with WORKFLOW in the workflow description topic. These will be expanded to their defined values in any topic that uses the workflow. For example:
  • Set WORKFLOWNOTICE = This topic is under document control.
will define WORKFLOWNOTICE in any topic that uses the workflow.

-- CrawfordCurrie - 02 Sep 2009

ItemTemplate edit

Summary Conditional transitions for WorkflowPlugin
ReportedBy DeanSpicer
Codebase
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component WorkflowPlugin
Priority Enhancement
CurrentState Closed
WaitingFor
Checkins WorkflowPlugin:170815c2aa37 WorkflowPlugin:379496fd2c9f
TargetRelease n/a
ReleasedIn
I Attachment Action Size Date Who Comment
Workflow.pm.diffdiff Workflow.pm.diff manage 1 K 14 Jul 2009 - 16:10 DeanSpicer  
Topic revision: r4 - 02 Sep 2009, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy