Creating a state machine
This first recipe is to create a state machine for vehicle inspection. In Chapter 14, Workflow Development, we created a workflow task and an inspection status field. In this recipe, we will use a state machine to handle the inspection status change logic.
Getting ready
We need to have a table with a status field with an initial and final status, such as the InspStatus
field we added to the ConWHSVehicleTable
table in Chapter 14, Workflow Development.
How to do it...
To create a state machine, follow these steps:
- Open
ConWHSVehicleTable
in the designer. Right-click on theState Machines
node and chooseNew State machine
. - Rename the new state machine
InspStateMachine
and complete the properties as shown in the following table, creating labels for theDescription
andLabel
properties:
Property | Value |
Description | Use this to control the inspection status |
Label | Inspection status |
Data Field | InspStatus |
- Right-click on the new state machine definition and select
New State
. - Complete the properties...