1. Trang chủ
  2. » Công Nghệ Thông Tin

Thủ thuật Sharepoint 2010 part 99 doc

7 99 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 7
Dung lượng 362,86 KB

Nội dung

Building Workfl ows in SharePoint 2010 WHAT’S IN THIS CHAPTER? Why workfl ow is important  Core workfl ow topics  Confi guration options for workfl ow  Using workfl ow tools such as SharePoint Designer and  Visual Studio 2010 It’s no secret that user collaboration using SharePoint 2010 improves overall effi ciency and productivity within organizations. To successfully accomplish this, clearly defi ned and reliable business processes must be in place to govern how collaboration within an organization will occur. These processes can be managed several ways, but the most effective way is to leverage the workfl ow capabilities of SharePoint 2010. W o r k fl o w is an automated business process. Rather than have users manually track and man- age a process, you can create a workfl ow that predefi nes the necessary steps and actions needed to complete the task at hand. By automating this process, human error is eliminated, responses can be tracked, actions are consistent, and user responsibility is kept at a minimum. Workfl ows provide an easy way to improve the overall effectiveness of your solution while minimizing the costs of managing business processes. In this chapter you will learn about workfl ow in SharePoint 2010 and the vital role it plays in an effective enterprise solution. You will also learn how to create workfl ows and use them in real-life scenarios. 25 746  CHAPTER 25 BUildiNg WorkfloWs iN sharePoiNt 2010 WHY USE WORKFLOW? Organizations work hard not only to fill their staff with highly qualified employees, but also to train them how to perform their daily tasks. In the ever-evolving scheme of things, whereby business pro- cesses change, document templates are updated, and new tasks are assigned, even the most attentive, responsible, and well-trained employee has moments of fallibility. Human-based processes are never 100% effective. Workflows provide a dependable solution to this fallibility, one that enables users to focus on actually doing their day-to-day work, rather than on how the work needs to be done. Workflows execute with a level of consistency that is unmatched by user-managed processes, and their flexibility enables them to be configured and reconfigured to meet the needs of your organization. In addition to being more effective than manual processes, workflows can be very easy to set up. The options in the browser provide users with the necessary tools to create workflow associations; and with a little training, users can also be taught how to create their own workflow solutions. The only options that will be out of the reach of typical SharePoint users are custom solutions built in Visual Studio. WINDOWS WORKFLOW FOUNDATION The workflow technology used in SharePoint 2010 is based on the latest version of Windows Workflow Foundation (WF), WF4. First introduced in 2005, Workflow Foundation is a framework created by Microsoft to provide a consistent development experience with other technologies based on the .NET Framework. This framework fully supports Visual Basic, .NET, and #C programming languages. For building custom activities, an extensible model and designer is also provided. For the release of SharePoint 2010, a new set of features will be available for developers to create custom workflow solutions. The following are just a few of the improvements available with the latest version: A new workflow designer allows for working with much larger and more complex workflows  without sacrificing performance. The data flow model has been greatly improved, providing simplified definition of the flow of  data both into and out of workflows, as well as data storage. The introduction of Flowchart, a new activity that enables developers to map out the work-  flow process from a more logical perspective. A new programming model allows for simpler workflow authoring.  Windows Communication Foundation (WCF) integration now enables new messaging activi-  ties and improved communication. If you are not a developer, the technology specifics behind workflows in SharePoint 2010 may be of little value and/or concern to you. You are probably more concerned with why workflows are used and when to deploy them in your environment. However, it is still valuable to understand the underlying technology and to be aware that the various tools you will use to create and participate in workflows utilize this same technology. Workflow Basics  747 WORKFLOW BASICS Before getting into the nitty-gritty details of SharePoint 2010 workflow, it is important to have a good grasp of the basics. Like anything else, you need to make sure you can walk before you run. Terminology First and foremost, you need to be familiar with the proper terminology: Workflow template  —A workflow template is a reusable workflow solution that has been deployed and installed in your SharePoint environment as a feature. Like all features, it must first be activated before it can be used. By default, the out-of-the-box templates are activated, but if you create a custom workflow template, make sure to check whether the feature is activated before you attempt to create a workflow based on that template. Use the follow- ing steps to check the feature settings in your site collection (you must be a site collection administrator): 1. From the top-level site in your site collection, click Site Actions  Site Settings. 2. Under the Site Collection Administration section, click Site Collection Features. 3. Ensure that the workflow features have a status of Active, as shown in Figure 25-1. FIGURE 251 Workflow association  —A workflow association is a specific connection between a workflow and a target list, library, content type, or site. For example, when you add an out-of-the-box workflow to a document library, you are taking the existing workflow template and creating a workflow association between the workflow and the document library. Workflow instance  —A workflow instance is the individual workflow process running on a specific item or site, based on a specific workflow association. When you are using an approval workflow in a list and the workflow is set to start on item creation, when an item is created, a new workflow instance starts running on the item. Reusable workflow  —As the name suggests, a reusable workflow is any workflow that can be reused in your SharePoint environment. However, this can be a bit confusing. In the past, workflows were reusable only if they were created as workflow templates. This meant that a workflow had to be an out-of-the-box template or a custom solution created in Visual Studio. However, Microsoft Office SharePoint Designer 2010 is now capable of creating “reusable workflows.” These workflows will not be as reusable as workflow templates, but nonetheless they are reusable. These types of workflows are covered later in the section “SharePoint Designer 2010.” 748  CHAPTER 25 BUildiNg WorkfloWs iN sharePoiNt 2010 Although several workfl ow instances can be running on an item, only one work- fl ow instance of a given workfl ow association can run on an item at one time. Depending on how you start a workfl ow, there could be situations in which a workfl ow will run on creation and restart when the item is edited. In this case, starting the new workfl ow instance terminates the old workfl ow instance. Workfl ow Association Types In addition to having various methods of starting a workfl ow, workfl ows can be associated at differ- ent levels within SharePoint: Lists/Libraries  — By creating the association at this level, the workfl ow will run only on items created within the specifi ed list or library. If you were to save this list or library as a template, any out-of-the-box workfl ow templates used would be associated with the tem- plate, making them part of anything created from the template. Content types  — By associating the workfl ow with a content type, the workfl ow will run on all items created with this content type. This allows for a reusable workfl ow solution if you were to use the specifi ed content type in multiple lists or libraries. The management features in Central Administration enable you to reuse a content type with a workfl ow across sites, site collections, and web applications. Sites  — Some workfl ows aren’t associated with list and/or library items and are triggered by a different mechanism. Workfl ows of this nature can be associated at the site level. The abil- ity to associate workfl ows with sites means workfl ow authors are no longer required to use list and library items. Possible scenarios for this would be for the workfl ow to run when the home page of the site was edited or a new Web Part was added to the page. Only workfl ows created with SharePoint Designer 2010 and Visual Studio 2010 can be associated at the site level. Using the Ribbon Now that you have the basic vocabulary down, it’s time to locate the workfl ow options using the SharePoint 2010 user interface. Throughout this book, a common theme for SharePoint 2010 and other Microsoft applica- tions is the Ribbon. It is here that you will fi nd workfl ow options for sites, lists, libraries, items, and documents. We will fi rst look at the Site Workfl ows option, which you can fi nd on the All Site Content page of the current site (see Figure 25-2). By clicking the link for Site Workfl ows, your browser will take you to the “Workfl ows: [your site]” page, where you can start a new site workfl ow or view information about existing workfl ows. FIGURE 252 Workflow Basics  749 The more commonly used workflow links are located in the Lists and Libraries ribbon. When you navigate to a list or library, you will see a new tab of options related specifically to that list or library, List Tools or Library Tools. If it is a list, you will see two options. These vary according to the type of list, but for a custom list you will see Items and List. If it is a library, you will also see two options, but these options will be related to the library and will vary by library type. For a document library, these options are Documents and Library. In a document library, when you click on the Documents tab under Library Tools, the Ribbon will contain a set of available options that you can perform on a document. Toward the right, there is a section titled Workflows (see Figure 25-3). This section has several options: Workflows  —This is the link you will primarily be concerned with. By clicking the Workflows link, called out in Figure 25-3, you will be taken to the “Workflows: [document name]” page. From here you can manually start a new workflow or view information related to workflows that are currently running on the item. Workflows that you can start on the item are displayed at the top of the page. These options vary according to the type of library or list that you are in. For a document library, you should see options for several out-of-the-box workflows. For lists, these same workflows may not be available. If you have created a specific workflow asso- ciation that is set to start manually, you should also see the option to start that workflow. FIGURE 253 Publish  — If versioning is enabled, this link will publish a major/minor version of the document. Unpublish  — If versioning is enabled, this link will unpublish the current version of the selected document. Approve/Reject  — If Content Approval is enabled, this option will be available to users with Approval permissions to reject or approve documents. Cancel Approval  —This option will cancel the approval of the selected document. If no documents have been selected, many of these options will be grayed out. When you select a document, these options become available, although for some documents these options may not be available until you create a specific workflow association or you enable specific features such as Versioning and Content Approval. The other option you will see under Library Tools is Library. Clicking this tab displays all of the options you have for configuring the document library itself. On the far right is the option for Workflow Settings. Clicking this drop-down menu will display several options, as shown in Figure 25-4. 750  CHAPTER 25 BUildiNg WorkfloWs iN sharePoiNt 2010 FIGURE 254 Workflow Settings  — Selecting this option will take you to the “Workflow Settings: [library]” page. Here you can see all workflow associations that exist on the library. If you have several workflows running on multiple content types, a drop-down menu enables you to select a con- tent type to view. In addition to the existing workflow associations, you have links to Add a workflow, Remove a workflow, and View workflow reports. Add a Workflow  —Although this option is also available through the Workflow Settings link, it is important enough to have it here as well. Clicking this link takes you to the “Add a Workflow: [library]” page. Here you can select a workflow template to create a workflow asso- ciation with your library. Depending upon the template you choose, you will be prompted for various configuration options, but each template should require you to enter a unique name, task list, history list, and start options. Create a Workflow in SharePoint Designer  —When you click on this link, SharePoint Designer 2010 will open and pop up a new window for creating a new workflow. This option is covered later in the section “SharePoint Designer 2010.” Create a Reusable Workflow in SharePoint Designer  —When you click on this link, SharePoint Designer 2010 will open and pop up a new window for creating a new reusable workflow. This option is also be covered later in the section “SharePoint Designer 2010.” Workflow Initialization The first, and sometimes the most crucial, step in workflow creation is deciding what action will trigger a workflow to start, also called initialization. This one starting point will play a major role in the structure of the workflow. Following are the ways to initialize workflows in SharePoint 2010: Start manually  —This option enables users to manually start a workflow on an item of their choosing. The only requirement is that the user must have Participate permissions on the item where the workflow will run. However, if the creator of a workflow association selects the option to start the workflow manually, he or she may also choose to configure the workflow so that only users with the Manage Lists permission can start the workflow. Manually start- ing the workflow is not the ideal option, as it puts additional responsibility on the user. 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 . These types of workflows are covered later in the section SharePoint Designer 2010. ” 748  CHAPTER 25 BUildiNg WorkfloWs iN sharePoiNt 2010 Although several workfl ow instances can be running. home page of the site was edited or a new Web Part was added to the page. Only workfl ows created with SharePoint Designer 2010 and Visual Studio 2010 can be associated at the site level. Using. it’s time to locate the workfl ow options using the SharePoint 2010 user interface. Throughout this book, a common theme for SharePoint 2010 and other Microsoft applica- tions is the Ribbon.

Ngày đăng: 02/07/2014, 12:20