Configuring Workflows Using the Browser 751 Start on item creation —This option will start the workflow as soon as a user creates or uploads a new item to the list or library. This start method is more commonly used because it requires less user responsibility and the workflow is guaranteed to run for every content type in the list or library. Start when an item is changed —This option will start the workflow when an item is edited. If a workflow instance is already running on an item, then it will be terminated and the workflow will restart. You can have only one workflow instance running on an item at a given time. You can select multiple or all options — Make sure you understand the implications of having multiple start methods. The obvious concern is interference with the business process: Triggering a workflow to start when another workflow is running will cancel the previous instance. It is also possible to use this feature to create an infinite loop, which is never a good thing. Now that you’ve learned some of the basic components of workflows in SharePoint 2010, the next few sections cover the different tools that you use to create and participate in workflow solutions. As with most things in SharePoint, there are several options for creating similar workflow solutions. These sections will clarify the benefits of using one option over another. CONFIGURING WORKFLOWS USING THE BROWSER Because the workflow information for Windows SharePoint Foundation 2010 and Windows SharePoint Server 2010 is very similar, this section groups both of these versions together. Any vari- ations between the features and functionalities of the two versions are noted. Out-of-the-Box Templates To get you started, SharePoint 2010 ships with templates you can use to begin creating workflows. With simplicity, ease of use, and quick deployment in mind, these templates provide users with a great out-of-the-box solution set that can be used to create a variety of workflows: Three-State —This workflow is used to track items in a list. It does this by using a predefined choice column. The column has three choice values that correspond to the three “states” of the workflow: Initial State (Active), Middle State (Resolved), and Final State (Closed). In the configuration page for this workflow, you specify this column and then set the task details for each choice value. When an item is running an instance of this workflow, as the item’s speci- fied choice column is updated, the task details for that choice column value, or state, is trig- gered, and then moves on to the next state. An example of this workflow would be on a Help Desk item that had three states defining its status: Open, Pending, and Closed. Different users would be assigned tasks based on the status of the item. Approval —This template routes a document for approval. Users that have been assigned as approvers can approve or reject the document, reassign the approval task, or request changes to the document. During the configuration process, you can specify the approvers and define 752 CHAPTER 25 BUildiNg WorkfloWs iN sharePoiNt 2010 stages of the workfl ow. If the workfl ow is started manually, the user who starts the workfl ow can specify which users the workfl ow notifi es for document approval. Each stage can have a different set of approvers; and you can also defi ne whether you want the stage approval to run serially or in parallel. Serial approval causes the workfl ow for that stage to request approval for each specifi ed user, one at a time. The workfl ow will move on to the next stage, or complete the workfl ow, when the last user has completed his or her task. Parallel approval creates tasks for every user specifi ed at the same time, and waits for all of them to complete their tasks before moving on. An example of this workfl ow would be a defi ned two- stage approval process for a Time Off request submitted as a Microsoft Word document. The fi rst stage might be manager approval, and the second stage could be the Human Resources department confi rming that the employee has available time off. Disposition Approval —This template supports both records and document management. Working in conjunction with a preconfi gured Expiration Policy section of an Information Management Policy, this workfl ow will assign a task to a specifi ed user who reviews the item and then approves or rejects the item’s deletion. This workfl ow is invaluable in situations where records and document management are paramount. A common example would be an organization that has a mandatory three-year retention requirement for storing documents related to a project. The organization could use the Disposition workfl ow to work with an expiration policy so that the project manager would be assigned the task of deleting the proj- ect documents after the necessary time had elapsed. Collect Signatures —This template will automatically request assigned users to add their sig- natures to a document. These requests are similar to the Approval workfl ow, but you aren’t able to confi gure the notifi cation message, duration information, and other confi gurations. The Collect Signatures workfl ow request is very basic. The assigned users can be specifi ed when the workfl ow association is created and/or when a user manually starts the workfl ow. Even though the usage information of users can be tracked within most applications, some organizations still require an actual signature on documents. For those situations, this work- fl ow is ideal. Publishing Approval — Similar to the Approval template, this template is specifi cally for the approval of publishing page items. Collect Feedback —This template forwards the document to assigned users who will provide feedback. These requests can be confi gured the same way Approval workfl ows can be con- fi gured. Once the workfl ow is completed, all the feedback is compiled and forwarded to the user who initiated the workfl ow. The only workfl ow that ships with SharePoint Foundation 2010 is the Three- State workfl ow. All other templates are only available with the installation of SharePoint Server 2010 (both Standard and Enterprise versions have the full set of templates). Confi guring Workfl ows Using the Browser 753 Microsoft O ce 2010 Integration One of the major assets of leveraging workfl ows in SharePoint 2010 is the complete integration with Offi ce 2010 applications, including Outlook. Although users cannot create workfl ows from Offi ce applications, they can participate in workfl ows through the various applications. From the File button, users can manually start workfl ows. In Outlook, when users are e-mailed Tasks or Workfl ow e-mails, they can click on usable links both in the body of the e-mail as well as the Outlook application itself to update tasks and workfl ow items. This smooth integration enables users to work on daily tasks in Offi ce without ever having to switch back and forth from their browser. Unfortunately, the workfl ow options that exist in the Microsoft Offi ce 2010 applications are only available when you are running SharePoint Server 2010. The workfl ow integration features are not available with SharePoint Foundation 2010. This applies not only to the out-of-the-box workfl ow templates, but to custom workfl ow solutions as well. Creating a SharePoint 2010 Workfl ow for a Real World Scenario This section introduces an example scenario for using a workfl ow and then walks you through the steps to create it. Expense Report Approval Scenario An organization has a group of users who need to submit expense reports and have them approved by both their manager and then a member of Accounts Payable. Currently, the users e-mail their requests or manually take their requests to their manager, who then e-mails or manually takes the requests to the Accounting department. During the two years they have used this system, countless reports have been lost, rejection reasoning is still unclear, and requests are rarely processed in a timely fashion. This was all fi ne and dandy back in the days of “sneaker net” but it is 2010 and computers can do this type of stuff far better than you or your intern. After multiple complaints, the manager decides to create a workfl ow to manage the process. To his surprise, a simple template is available that would resolve all the issues they have been experiencing. From this template he confi gures the workfl ow to start when the users submit the form, assigning himself as the fi rst approver; creating another stage for the second approver (Accounting depart- ment); and then setting a due date of fi ve days from the date of submission for each request. Now, rather than guess where to fi nd the requests, he can approve or reject requests from Outlook, or he can access his SharePoint site and look at a Tasks list that has been set up so that users can view items assigned to them. This list contains his tasks to approve expense reports. In the event that he or Accounts Payable rejects a request, they can provide feedback to the requester so that the request can be resubmitted. Since the approval workfl ow has been used, no requests have been lost, users are getting the necessary feedback, due dates are being tracked, and everyone’s sneakers are still in great shape. 754 CHAPTER 25 BUildiNg WorkfloWs iN sharePoiNt 2010 Creating the Workflow The preceding scenario is a good example of a real-world situation for which an out-of-the-box solution is a perfect match for a desired business process. Because you already know how to create lists and librar- ies and configure their views, this step-by-step process describes how to create this workflow: 1. Although a Forms Library may be better suited for web forms, this example will use a simple Document Library. Click Site actions and New Document Library. 2. Enter a name and description for the new library and make any Navigation, Version, and/ or Template configurations. For this example, the name of this library will be Workflow Documents. 3. This example uses the out-of-the-box Approval template which requires the use of a Tasks list. You will need to create a Tasks list (many site templates will create this list for you), and configure it to send an e-mail when a task is assigned. Click on Site Actions and select More Options … 4. On the left, select Filter By: List. 5. Click on the icon for Tasks, and enter Workflow Tasks for the name. Click Create. 6. To enable e-mail notifications click the List tab from List Tools. 7. From the right side of the Ribbon click List Settings. 8. Under General Settings, click Advanced Settings. 9. In the E-Mail Notification section, select Yes for “Send e-mail when ownership is assigned?” as shown in Figure 25-5. FIGURE 255 10. Scroll down the page and click OK. 11. Navigate back to the Workflow Documents library. In the Ribbon, click the Library Tools tab and then the Library tab (see Figure 25-6). FIGURE 256 Configuring Workflows Using the Browser 755 12. On the right side of the Ribbon, click the Workflow Settings drop-down menu and select Add a Workflow (see Figure 25-7). FIGURE 257 13. On the Add a Workflow page shown in Figure 25-8, in the Workflow section, select Approval – SharePoint 2010. Enter a name, Expense Report Approval. 14. From the same page, select a Tasks List and History List. This example will use the Workflows Tasks list we created earlier and the Workflow History list. 15. For Start Options, select “Start this workflow when a new item is created.” Also, deselect the existing option “Allow this workflow to be manually started by an authenticated user with Edit Item Permissions.” FIGURE 258 756 CHAPTER 25 BUildiNg WorkfloWs iN sharePoiNt 2010 16. Click Next. You will be forwarded to the Change a Workflow Expense Reports Approval page. All of the sections described in steps 17 through 26 are shown in Figure 25-9. 17. In the Approvers section, you need to enter an approver to the top Assign To box; the exam- ple shows Manager Smith. Leave the Order box as “One at a time (serial).” If this is your first time using a “people picker,” you need to enter the user’s name and then click the little person icon with the blue checkmark. This will validate that name entry. If it successfully validates the name, it will be underlined. If not, it will have a red line underneath. If this is the case, click the little book icon and do a search for the user. When found, add the user to the Assign To box. 18. Click Add a new stage. Add your next approver (accounts department) in the second Assign To box. Leave the Order box as “One at a time (serial).” 19. For the Expand Groups section, this value depends on whether or not you entered a group for the value in the Assign To box. If you didn’t enter a group, then this section doesn’t mat- ter. If you did, then you have the option to either assign a task to every user who is a mem- ber of that group or assign one task to the group and then let someone claim that task and complete it. For this example, you can leave the box checked so that anyone in the Accounts department can give approval. 20. In the next section, configure the Request to say whatever you want. For this example, it will say “Please review the request and approve or reject.” 21. In the Due Date for All Tasks section, specify the due date. This is valuable only if the workflow is being created manually and the user can specify the date. For a workflow that is being started when an item is created such as this example, use the next section, Duration Per Task. For this example, enter the number 5. 22. The Duration Units will be Day(s). 23. You don’t need to CC anyone, so leave this field blank. 24. For the End on First Rejection field, you do want to cancel the workflow if the document is rejected. Cancelling the workflow ensures that no other steps will run. 25. In the next field, End on Document Change, you also want to cancel the workflow if a change is made to the document. You wouldn’t want your users to submit an expense report for $100 and then change it to $1,000,000 after approval. Therefore, if a user tries to change anything, the workflow is rejected. 26. Content Approval is not enabled for this list, so you don’t have to worry about the last sec- tion. Click Save. That’s it. Now when an item is added to the Expense Reports library, the workflow will start and create a task for the user. Once that task is completed and approved, the workflow will trigger the second approval request task. If that is approved, the workflow will complete and notify the user who created the item. If the item is rejected at either step, then the workflow will cancel and the approver can enter comments for the user, who can review them and then resubmit the form. If the user tries to edit the form while the workflow is running, the workflow will cancel. Configuring Workflows Using the Browser 757 FIGURE 259 Editing/Deleting Workflows As you have seen, using the out-of-the-box workflow templates to create workflows in SharePoint is a simple process. Continuing along the same lines, this section describes how to manage existing workflows and the process to edit and delete workflows. As mentioned earlier, you can access the Site Workflows page from the All Site Content page. On this page you can view the existing workflows; and by clicking on any one of them, you can pull up the workflow information related to that instance. If that workflow is currently running, you will see the option to terminate the workflow. This will stop the workflow instance. To delete or edit a site workflow, you must do so through the client application used to create it. With regard to SharePoint 2010, this will be either SharePoint Designer 2010 or Visual Studio 2010. To manage workflows running on a list or library, you need to navigate to that list’s or library’s work- flow settings page (refer back to Figure 25-7). From here you can view the current workflows run- ning on this list. If you want to make a change to a workflow on this list, you must know the type of workflow it is. If it is an out-of-the-box template, you can click on it and make your changes directly through the browser. If it is a custom workflow you must edit the workflow in its native application. 758 CHAPTER 25 BUildiNg WorkfloWs iN sharePoiNt 2010 Once you have made the changes, the workflow will be updated. For out-of-the-box workflows this process will update the existing workflow and all running instances, so be careful not to change the workflow is such a way that will negatively affect one of the instances. After editing custom workflows created with SharePoint Designer or Visual Studio, a previous version of the workflow will appear on the workflow settings page, as shown in Figure 25-10. To remove an existing workflow, simply click Remove a workflow, and you can select the workflows for which you would like to Allow instances of the workflow, Deny new instances, or Remove the workflow associa- tion. When you edit a workflow and two or more versions of that workflow are present, it is important to ensure that the previous versions are not allowing new instances. In addition, when no instances are running on a previous version, you should remove them to help keep your settings from being clut- tered. The last set of information you can view is the workflow reports. This can provide activity dura- tion, cancellation, and error reporting on any workflow that is associated with the given list. FIGURE 2510 At the item level, your workflow management options are even simpler. Referencing Figure 25-3, navigate to the workflow settings page for an item. The page will be similar to the site workflows page. On this page you can view the same information. Click on a specific workflow to view informa- tion specific to that workflow instance. You can’t edit the workflow instance or association, but you can terminate the workflow that is running on an item. You can also see the workflow history for an item. This can provide information regarding different steps of a workflow and when they were com- pleted. It can also be used to help troubleshoot or debug any issues with an existing workflow. WORKFLOW TOOLS IN SHAREPOINT DESIGNER 2010 Although we covered SharePoint Designer 2010 in Chapter 22, it is necessary to reiterate the impor- tant pieces specifically related to workflow. After all, when out-of-the-box workflow templates fail to meet your needs, SharePoint Designer 2010 can be used to create more complex workflow solutions. One distinct difference from the out-of the-box templates is that SharePoint Designer is capable of creating a variety of solution types. With the out-of-the-box templates, your options are . Microsoft Offi ce 2010 applications are only available when you are running SharePoint Server 2010. The workfl ow integration features are not available with SharePoint Foundation 2010. This applies. the client application used to create it. With regard to SharePoint 2010, this will be either SharePoint Designer 2010 or Visual Studio 2010. To manage workflows running on a list or library, you. workfl ow that ships with SharePoint Foundation 2010 is the Three- State workfl ow. All other templates are only available with the installation of SharePoint Server 2010 (both Standard and Enterprise