Share via


Adding and Modifying States in a Workflow

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The Add New Workflow Process option only creates an empty workflow process, so you must create states, transitions, and events using the Workflow Design toolbox on the design surface.

For each step an item must go through in your process, you add a state to your workflow. Then, you create appropriate transitions to connect your states and designate the flow of your business rules. You enhance the workflow process by adding appropriate events to your states and using these events as triggers for the script you write.

The Workflow Design Surface and toolbox are used to add and modify states in the following ways:

  • Adding a State
  • Renaming a State
  • Setting a State Caption
  • Deleting a State

Adding a State

The State tool, in the Workflow toolbox, is used to place state shapes on the Workflow Design Surface. A state shape represents state operations performed by the workflow.

There are three ways to add a state shape. You can double-click the State tool, drag the State Shape tool onto the design surface, or single-click the tool and single-click the design surface.

If you plan to add multiple states, you can turn on Sticky mode. Press CTRL and click the State Shape tool, and then click multiple times the design surface to add states. Press ESC to turn off Sticky mode.

**Note   **When Sticky mode is turned on, you can select any of the workflow tools, and add objects to the diagram.

To add a workflow state

  1. Open the Development Environment. Open an existing solution, or use File, New to create a workflow project. The solution, along with any of its projects and existing workflow processes, is displayed in the Solution Explorer.

  2. Select the workflow process from the Solution Explorer.

  3. From the View menu, select Open, or double-click the workflow process.

    **Note   **You can view the Toolbox by selecting Toolbox from the View menu.

  4. Select the State tool, and click the design surface. The State shape will be created at the location of the click. Properties, such as name and caption, can be set for the state shape in the Property Page or Properties Grid.

  5. To connect this new state with existing states, you must create a new workflow transition.

    **Note   **To add one shape in the diagram window multiple times, press and hold CTRL as you choose the shape in the Toolbox. Click in the diagram to place the shape, enter a name if desired, and then click again to add another shape. Choose the Pointer in the Toolbox to stop adding shapes on the design surface.

Renaming a State

State names must be unique. They must be comprised of letters, numbers, and underscores. No spaces or extended characters are supported. State names are used to identify uniquely the state and do not ever have to be shown to the user. They are used to create associated event procedures, such as State1_OnEnter. For many applications, it is only important that the workflow author/administrator understand the meanings of the state names. As long as a workflow process is in development, you can change the names without repercussions. However, when a workflow process is in production, if you change the name, you potentially are changing the workflow logic.

**Caution   **If you have a workflow process that is in production, do not rename states without changing items to a state value represented on the diagram.

To rename a state

  • On the Workflow Design Surface, select the state, and enter a new name for the state in the Properties Grid. Names must consist of letter, numbers, and underscores.

Setting a State Caption

State captions also must be unique. However, captions support extended characters, such as spaces and non-English characters.

To set a state caption

  • On the Workflow Design Surface, select the state, and enter a new caption value directly in the state itself or in the Caption property in the Properties Grid.

Deleting a State

If you no longer require a state in the process, you can remove it. Any associated transitions, actions, and script will be removed.

To delete a state

  1. Make sure none of the existing items in the folder are in the state you want to delete. If existing items do use the state, you must move them to another state.

    **Caution   **If you delete without changing existing rows to a different state, those items cannot be modified.

  2. Make sure the state following the one you want to delete has another event entering it. If it does not, add another state or event to connect that state to the diagram.

  3. On the Workflow Design Surface, right-click the state, and choose Delete.

    The state and all of its associated events are removed from the design surface and deleted from the workflow.

    **Note   **Any transitions entering or leaving the state will get deleted also.

See Also

Building a Workflow Process for Exchange Server | Understanding the Workflow Process | Creating the Exchange Folder for the Project | Creating the Project and Workflow Process for Exchange Server | Setting the Project Properties for Exchange Server | Using the Workflow Design Surface | Adding and Modifying Transitions in Workflow | Copying a Workflow Process for Exchange Server | Deleting a Workflow Process for Exchange Server | Viewing and Printing the Workflow