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

Thủ thuật Sharepoint 2010 part 89 pot

8 44 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 8
Dung lượng 419,76 KB

Nội dung

670  CHAPTER 22 WorkiNg With sharePoiNt desigNer 2010 FIGURE 2240 27. For the Filter Criteria, set the values to the following criteria: Field Name: League  Comparison: Equals  Value: NFL  28. Click OK. 29. The new has been created. To test it, open the site in the web browser again and navigate to the list. When the list opens it will show the All Items view by default. To switch to the new view, with your mouse hover over the All Items link in the bread crumb, you’ll be able to switch to the NFL view, which will now show only the NFL teams (see Figure 22-41). FIGURE 2241 This example walked though many of the common tasks related to views and forms in an organiza- tion. SharePoint Designer 2010 makes it easy to customize the display of information with the XSLT List Web Part and integration with InfoPath forms. Workflows One of SharePoint’s biggest selling points is the capability to use workflows to manage business processes. SharePoint Designer is the preferred tool for creating custom, rules-based declarative workflows that don’t require any code. For more specific information on workflows in SharePoint 2010, see Chapter 25, which is dedicated entirely to this subject. SharePoint Designer 2010 can create three types of workflows: List workflow  — These workflows are directly associated with a list. This was the only type of workflow supported by SPD 2007. What Can You Do with SharePoint Designer 2010?  671 Reusable workflow  — These workflows can be associated with many lists or libraries or con- tent types, and can be reused throughout your SharePoint sites as needed. Site workflow  — These workflows are not associated with a specific list or content type. Another new workflow capability in SharePoint 2010 enables you to import the out-of-the-box work- flow templates into SPD 2010 and modify them as necessary. However, note that modifying a workflow template from the top-level site in your site collection means that you are modifying the template used by all sites in the site collection. If you choose to use one of the out-of-the-box templates as the basis for your workflows, it is best to make the changes to workflows from a subsite. This is actually a copy of the workflow, so making changes here will not cause changes to all workflows based on that template in the site collection. Workflow Designer The Workflow Designer has been significantly changed to enable visualization of the entire workflow from a single screen. To open the Workflow Designer, click the Workflows link in the navigation pane and then select the option to create a new workflow from the Ribbon (any of the workflow types will work). As mentioned previously, SPD 2010 workflows are declarative in nature. Declarative workflows are rules-based workflows, which use conditions and actions to define a process. This is very similar in concept to how rules are defined in Outlook; when an e-mail arrives it is evaluated against the first rule and then subsequent rules until a condition is found that applies to the e-mail. When your work- flow requires more complexity than what is provided by the out-of-the-box workflows, declarative workflows are a valuable alternative. Because they don’t require any code, they can be quickly created and deployed. Developers can even use SPD to help prototype workflows, which can then be imported into Visual Studio 2010 for further customization. The Workflow Designer provides a visual representation of the declarative workflow, separated into the various steps, conditions, and actions. With the designer open, clicking on the Step button in the Ribbon adds a new step to which conditions and actions can be added: Conditions  — These are the rules that are used to drive the workflow. If a condition is true, then whatever is contained within the conditional block will be processed. If a condition isn’t true, then the workflow will move along to the next condition, assuming there is another one. Clicking the Condition button in the Ribbon will display the complete list of available conditions. Actions  — These are the statements that perform a specific activity, such as sending an e-mail or modifying a field. Clicking the Actions button in the Ribbon will display the complete list of actions available for use in workflows. Once the conditions and actions are added to the workflow, you can click the specific steps of the workflow to more specifically define what should happen in that step. For example, if you were to add an action that sends an e-mail, you’d need to click on the action itself to define the e-mail’s recipient, subject, and body. You can also use variables in these workflow steps so that depending on who started the workflow and other information that’s been captured, the resulting actions can vary. An example of this would be that the subject of an e-mail can be written based on the value of 672  CHAPTER 22 WorkiNg With sharePoiNt desigNer 2010 a field in the list that a workflow is attached to. Similarly, because another new feature in SPD 2010 makes it easy to look up a given user’s manager, you could create an approval workflow that is auto- matically sent to an employee’s manager. Creating a Site Workflow That Writes to a Custom List Creating standardized forms that have basic workflows is a common scenario in many companies. This example uses a site workflow to capture employee reviews submitted by employees, which their managers will then need to review and approve. To do this, you’ll create a custom list, customize the fields on the form that are used to start the workflow, look up the manager of the person submitting the workflow, write it all to a list, and then assign a task to the manager. 1. Open your site in SharePoint Designer and click Lists and Libraries in the navigation pane on the left. 2. Click the Custom List button in the Ribbon to create a new list called Employee Review with the following fields: Rename Title to Employee  Manager: Single line of text  Rating: Single line of text  Comments: Multiple lines of text  3. After all of the fields have been added click the save button to save the changes to the list. 4. Click the Workflows link in the navigation pane on the left. 5. Next from the Ribbon, click the Site Workflow button to create a new workflow (see Figure 22-42). 6. Name the workflow Employee Reviews and click OK. The Workflow Designer for the new workflow will automatically open. 7. With the Workflow Designer open, you should see a blinking horizontal orange line, which is used to indicate where the next action or condition will be inserted. But before you add any steps to your workflow, from the Ribbon, click the Initiation Form Parameters button (see Figure 22-43). This allows you to define parameters that are used to collect data when the workflow is started. In this case you want the user to fill out the form and then use the infor- mation that was entered throughout the workflow. FIGURE 2242 FIGURE 2243 8. From the Association and Initiation Form Parameters dialog, click the Add button (see Figure 22-44). What Can You Do with SharePoint Designer 2010?  673 FIGURE 2244 9. Name the fi eld Rating, choose Choice as the Information type (i.e., a menu to choose from), and click Next. On the Column Settings screen, enter the values shown in Figure 22-45 and click Finish. FIGURE 2245 10. Press the Add button to add another fi eld. Name this fi eld Comments, set it as Multiple lines of text, and click Next and then Finish. Click the OK button from the Association and Initiation screen. Workfl ows make use of two concepts that are sometimes confused: variables and parameters. Variables are defi ned during the workfl ow process and can be refer- enced throughout the workfl ow. In this example, the name of the initiator’s man- ager is a variable that is later written to a fi eld in a list. Parameters are user-entered information that’s captured during the workfl ow. In steps 9 and 10, parameters are defi ned that will be fi lled out by the user before the workfl ow process begins. 11. The Workfl ow Designer should open and there should be a horizontal, orange blinking cur- sor in a box titled Step 1. From the Ribbon, click the Action button and then click Lookup Manager of a User (see Figure 22-46). Optionally, instead of clicking the Actions button, you can start typing and SPD will try to fi gure out what you want it to do. 674  CHAPTER 22 WorkiNg With sharePoiNt desigNer 2010 12. A description of the action will be added to step 1. Click the link that says “this user” to specify whose manager will be looked up. The Select Users dialog, shown in Figure 22-47, will open. Select Workfl ow Lookup for a User and click the Add button. The Lookup dialog will display. FIGURE 2246 FIGURE 2247 13. In the Lookup dialog, set the following options: Data source: Workfl ow Context  Field from source: Initiator  Return fi eld as: Login Name  Click OK when you are done. The capability to look up a user’s manager in an SPD workfl ow is a new feature for this version. In this last step, the action looks at the Workfl ow Context to get the name of the Initiator, which has been set to return the Login Name of the user, which in turn is used to look up the name of the user’s manager. The manager lookup is performed against the user profi le. In order for this capability to work properly, user profi le synchronization needs to be confi gured and a manager needs to be specifi ed for the user. See Chapter 25 for details on this feature. 14. Click just below the action that was just completed but still within the Step 1 box. The orange cursor should show where the next action will be added. Click the Action button again in the Ribbon and select Create List Item (see Figure 22-48). What Can You Do with SharePoint Designer 2010?  675 15. In the new action, click the “this list” link. Select Employee Review. Click the Employee field and then click the Modify button to specify the values for this field. In step 9 and 10 you defined the values to be entered by the user. Because the name of the employee doing the review is the same as the person starting the workflow, you can get that automatically. 16. Click the function button (see Figure 22-49) and set the following values in the Lookup dialog: Data source: Workflow Context  Field from source: Initiator  Return field as: Display Name  Click OK and then click OK again. FIGURE 2248 FIGURE 2249 17. Repeat the same steps described in step 15 for the Rating field, but select the following values for the lookup: Data source: Workflow Variables and Parameters  Field from source: Parameter: Rating  Return field as: As String  Click OK and then OK again. You’ll be returned to the Create New List Item dialog. 18. From the Create New List Item dialog window, click Add and choose the Manager field. Press the function button as described previously. Set the following values for the lookup: Data source: Workflow Variables and Parameters  Field from source: Variable: Manager  Return field as: Display Name  Press OK and then OK again. You’ll be returned again to the Create New List Item dialog window. 19. Click Add and choose the Comments field. Click the function button and set the following values for the lookup: Data source: Workflow Variables and Parameters  Field from source: Parameter: Comments  Return field as: As String  676  CHAPTER 22 WorkiNg With sharePoiNt desigNer 2010 Press OK and then OK again. Verify that all of the fields have been created and then from the Create New List Item dialog shown in Figure 22-50, click OK. You should find yourself back at the Workflow Designer. 20. With the Workflow Designer open, click the Action button in the Ribbon and select Assign a to-do item. 21. Click the link for “a to-do item” and the Custom Task Wizard will open. Click Next. On the second page of the wizard, enter Employee Review in the Name field and click Finish. 22. Next, from the Workflow Designer click the “these users” link in the create to-do item action that you’ve been editing. From the Select Users dialog, click Workflow Lookup for a User, and then click Add. The Lookup for Person or Group dialog window will open. Set the following values for the lookup in the top section of the window: Data source: User Profiles  Field from source: Manager  Return field as: Login Name  23. For the fields at the bottom of the Lookup for Person or Group dialog window, for the Field value choose Account Name from the drop-down. Next press the function button to the right of the Value field. In the dialog that opens, set the fields as follows: Data source: Workflow Context  Field from source: Initiator  Return field as: Login Name  Similar to step 13, the name of the manager is being returned, but in this case it is for the pur- pose of assigning a task to the manager, which is why the Login Name is used as the return field. 24. Press OK on all the dialogs to accept the changes. 25. The workflow is now complete and should look similar to Figure 22-51. From the Ribbon, click the Save button (see Figure 22-52). Before the workflow can be used, it must first be published. To do so, click the Publish button in the Ribbon. FIGURE 2251 FIGURE 2250 FIGURE 2252 What Can You Do with SharePoint Designer 2010?  677 26. To try the site workflow, go back to your site and click Site ActionsView All Site Content. At the top of the page, click the Site Workflows link. 27. Click the Employee Reviews link (see Figure 22-53), which will open the page where you can fill out the form to start the workflow. Fill out the form and press Start. To make this form easier to access, you can copy the form’s URL and create a link directly to the form. FIGURE 2253 28. If you go back to the Employee Review list, you’ll see that a new item has been created, the manager has been successfully looked up, and the information entered into the form has been added (see Figure 22-54). A task should have also been created for the manager, which you can see by clicking Site Actions  View All Site Content then clicking on the Site Workflows link. FIGURE 2254 This example showed how you can create a workflow that captures information into a form, looks up the manager of the person who started the workflow, writes the information to a list, and then assigns a task to the manager. Although this was a very basic workflow example, these concepts can be expanded and repeated to create much more robust and complex workflows that don’t require any custom code. Branding As mentioned at the beginning of this chapter, most people associate SharePoint Designer with designing websites. When the product was introduced with SPD 2007, it was obvious by looking . organiza- tion. SharePoint Designer 2010 makes it easy to customize the display of information with the XSLT List Web Part and integration with InfoPath forms. Workflows One of SharePoint s biggest. processes. SharePoint Designer is the preferred tool for creating custom, rules-based declarative workflows that don’t require any code. For more specific information on workflows in SharePoint 2010, . You Do with SharePoint Designer 2010?  671 Reusable workflow  — These workflows can be associated with many lists or libraries or con- tent types, and can be reused throughout your SharePoint

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