Use Case: Define Workflow Variables
Actor
WorkflowDesigner
Documentation
Often a simple flow of states can't model all the details of a business process. For example, in the bill-passing example, a bill might be allowed to be revised and resubmitted once it is vetoed, but only if it has been vetoed once. If it is vetoed a second time, it is killed for good. To model this behavior, the state machine needs to carry a bit of extra information that "remembers" the past veto.
A variable is a piece of information that transcends states. Most variables are persistent. A variable might hold a counter, a flag, the name of the last user who did some action, or any other simple object.
Variables also serve the purpose of exposing metadata to the catalog or the user. There are five variables in the CMF default workflow: actor
, action
, comments
, time
, and review_history
. The first four are there to keep a record of who executed the last transition, what they did, why, and when. The last variable makes it possible for the user to view the workflow history of an object.
You can change the value of a variable when executing a transition or when entering a state. Visit a state you created in DefineStates then switch to the "Variables" tab. Here you can reset variables to some specific value. Then visit a transition you created in DefineTransitions then switch to the "Variables" tab. Here you can enter [WorkflowExpression]s that will be computed to determine the new value of a variable.