Design custom workflows by using SharePoint Designer
Microsoft Office SharePoint Server 2007 includes ready-to-use workflows that address some of your most common business processes, such as collecting feedback on a document or routing a document for approval.
But what if your team has a process that requires more than what the predefined workflows offer? For example, what if you want a workflow that extends beyond the approval or feedback process, so that it performs other actions, such as copying the document to another library when it's ready for publication?
With Microsoft Office SharePoint Designer 2007, you can design custom workflows that add no-code application logic to your SharePoint sites. Using the Workflow Designer, you create rules that associate conditions and actions with items in SharePoint lists and libraries. Changes to items in lists or libraries trigger actions in the workflow.
Note This article refers to an example SharePoint site created by Adventure Works, a fictitious company that manufactures bicycles, bicycle components, and bicycling accessories.
For example, the Technical Documentation team at Adventure Works designed a custom workflow. The Approval workflow included with Office SharePoint Server 2007 assigns a task with the options to Approve or Reject. However, the Editor on the team, Martin Bankov, wanted a bit more flexibility and functionality when he completes his tasks. By using the Workflow Designer in Office SharePoint Designer 2007, Martin designed a custom workflow with these options:
Approve and publish
Approve but route to Legal for review
Reject and return to writer
Each of these options triggers different actions in the custom workflow.
Create rules-based workflows
With Office SharePoint Designer 2007, you can create workflows that are based on rules. In the Workflow Designer, you choose the event that triggers the workflow. Then you specify the actions that you want the workflow to perform, and you can even identify the conditions under which these actions are performed. In addition, a workflow can include many steps so that it can evaluate and process multiple sets of conditions and actions.
When you understand the basic building blocks of a workflow, you can quickly design a custom workflow. The basic building blocks are the following:
Events An event is what starts or initiates a workflow. A custom workflow is always attached to one list or library. When you design the workflow, you choose which list to attach it to. An event in this list starts the workflow. There are exactly three events that can start a workflow: (1) An item is created; (2) an item is changed; or (3) a workflow participant clicks a start button on a workflow initiation form.
Actions An action is the most basic unit of work in a workflow. Office SharePoint Designer 2007 provides a set of ready-made, reusable actions for you to incorporate into your workflow. For example, your workflow can create, copy, change, or delete list items (or files in a library); check items in or out; send an e-mail message; and create a task for someone in the Tasks list.
Conditions When you design a workflow, you can create a rule that establishes a condition where the workflow performs the associated action only if that condition is true. Office SharePoint Designer 2007 provides several ready-made, reusable conditions for you to incorporate into your workflow. For example, you can specify that the workflow performs the associated actions only if an item is created or modified in a specific time span, or if it is created or modified by a specific person.
Steps A workflow is comprised of one or more steps. Each step can contain any number of actions and associated conditions. Steps allow you to group conditions and actions so that one set of rules (conditions and actions) can be evaluated and performed before a second set.
To make your workflow more dynamic and flexible, you can add an initiation form or a custom task form to the workflow. You can use a form to collect information from workflow participants at predefined times in the workflow and to enable participants to interact with the tasks for that workflow. You design the forms by using wizards, and Office SharePoint Designer 2007 generates the forms automatically when you finish designing the workflow.
For example, the custom workflow for the Technical Documentation team requires three different approval options. Each option triggers different workflow actions. When Martin designs the workflow, he uses the Custom Task Wizard to create the custom task form, as shown here.
When Martin finishes designing the workflow, Office SharePoint Designer 2007 generates the custom task form. Now, when people on his team approve documents, they see the following form in the browser. This form contains the options that Martin specified in the Custom Task Wizard.
Automate business processes
If you are creating a Web application to help automate a business process, the Workflow Designer in Office SharePoint Designer 2007 opens up new possibilities. With the Workflow Designer, you can integrate business rules and workflow logic into your Web applications without writing any server code.
For example, the Technical Documentation team wants a workflow that automates more of their process than just document approval. Using the Workflow Designer, Martin designs a workflow that team members can start manually when their document is ready for approval. The workflow creates a task to review the document, and the reviewer chooses one of the three options described earlier.
Martin designs the workflow so that it performs different actions, depending on the response that the reviewer submits in the custom task form:
If the reviewer chooses Approve and publish, the workflow copies the document to another document library named Ready for publication, and sends a message to the Documentation team.
If the reviewer chooses Approve but route to Legal for review, the workflow copies the document to yet another library named Requires legal review, and sends a message to the Legal department.
If the reviewer chooses Reject and return to writer, the workflow sends a message to the writer with the reviewer's feedback, and updates that item in the Documents library to show the most recent feedback.
In the Workflow Designer, the step that contains this conditional logic looks like in the following figure.
This is only one step of the workflow. Over time, Martin can modify and extend this workflow by adding steps. He can even design new custom workflows that are attached to the Ready for publication library and the Requires legal review library, and these workflows can be triggered whenever Martin's document review workflow creates an item there. The Workflow Designer is a powerful way to quickly automate business processes and add conditional logic to your Web applications.