Workflow Designer is really the first version of a workflow development interface for SharePoint Designer. Choose File New Workflow when a SharePoint site is open in SharePoint Designer to access Workflow Designer to create and edit workflows. Besides workflow creation, it also checks for workflow errors and is used to deploy workflows to SharePoint sites. The following points can help you understand the Workflow Designer user interface:
The workflow starts whenever an item in the Announcements list is updated or can be started manually.
The workflow has two steps that help you check to see if the created date of an item in the Announcements list is older than the current date.
If the previous condition is met, the workflow uses the Log to History List action, which is available in Workflow Designer to log a message into the Workflow History List.
NOTE
The Workflow History List is a special list available in SharePoint to track workflow actions, errors, and problems.
Follow these steps to create the workflow that performs the previous operation on a WSS v3 Web site. Ensure that the SharePoint site you're using for this exercise has an Announcements list:
Open a SharePoint site in SharePoint Designer and then choose File New Workflow to open Workflow Designer. The first screen of Workflow Designer, as shown in Figure 20.1, is a welcome screen that allows you to pick the SharePoint list or library that you want to associate the workflow with. It also allows you to choose the event that should trigger the start of the workflow.
Specify a name for this workflow. In the What SharePoint list should this workflow be attached to? dropdown menu, select the Announcements list. Click the Allow this workflow to be manually started for an item and the Automatically start this workflow whenever an item is changed check boxes, as shown in Figure 20.2.
Click Variables to open the Workflow Local Variables dialog box. You use this dialog box to create variables for storing workflow information.
|
Click Add in the Workflow Local Variables dialog box to open the Edit Variable dialog box. Specify a name and the data type for the variable. For this exercise, the data type to be used is Date/Time.
Click OK. The newly created workflow variable is shown in Figure 20.3.
Click OK to complete the creation of the workflow variable. This brings you back to the Workflow Designer window.
Click Next to move to the next screen in Workflow Designer. As illustrated in Figure 20.4, this screen is used to create the steps inside the workflow. In the first step for this workflow, you initialize the workflow variable created in step 4.
Specify a name for the step by clicking Actions and then clicking the More Actions menu option to open the Workflow Actions dialog box. As shown in Figure 20.5, the Workflow Actions dialog box lists the available actions in Workflow Designer. This list includes all the default and custom activities that are deployed to the Web server hosting the SharePoint site open in SharePoint Designer. You can use the Select a Category dropdown menu to filter the list of actions based on a particular category.
Choose All Actions in the Select a Category dropdown menu, select the Set Workflow Variable action, and then click Add. Figure 20.6 shows the interactive description for the Set Workflow Variable action. The Set workflow variable to value description for this action has two links: The workflow variable link allows you to choose the workflow variable that you want to set, and the value link provides the interface to specify a value for the variable. If you click the newly inserted action, you can enable a dropdown that allows you to delete the action or, if you're using multiple actions, you can change the order of the actions.
Click the workflow variable link. The link changes to a dropdown menu that allows you to choose the existing workflow variable created in step 4 or create a new variable by using the Create a new variable selection. For this exercise, select the workflow variable you created in step 4 from the dropdown menu.
Click the value link. The link changes to a text field with the ellipsis (...) button and the fx button next to it.
Click the ellipsis (...) button to open the Date Value dialog box, click the Current Date radio button, and then click OK. The completely configured action is displayed in Figure 20.7.
Click the Add workflow step link in the right pane of the Workflow Designer screen to add a new step to the workflow and then specify a name for the step.
Click Conditions to open a dropdown menu and then choose the Compare any data source condition menu option, as shown in Figure 20.8. Figure 20.9 displays the interactive description for the Compare any data source condition. The If value equals value description for this condition has three links: The first value link allows you to specify the left operand for the comparison, the equals link allows you to choose the comparison operator, and the second value link allows you to choose the right operand for the comparison. If you click the newly inserted condition, a dropdown menu appears that allows you to delete the condition or, if you're using multiple conditions, change the order of the conditions.
Click the fx button to open the Define Workflow Lookup dialog box, as shown in Figure 20.10. The Define Workflow Lookup dialog box is a commonly used dialog box in Workflow Designer and is used to specify a source of data. The dropdowns in the Define Workflow Lookup dialog box include the following:
Source: This is the list of SharePoint lists and libraries available in the SharePoint site in which the workflow is being created. It also includes the Workflow Data option that allows you to choose the variables that you create in the workflow. The Current Item option makes available the fields on which the item that the workflow (actually an instance of the workflow) is run.
|
NOTE
The source of data and the value it contains can be used as an operand for comparison or to set a value for a variable. For example, the source of data could be a SharePoint list column or a workflow data variable previously defined in the workflow.
Field: This is the list of columns/fields that exist in the SharePoint list or library selected in the Sousrce dropdown menu. When you select Workflow Data option in the Source dropdown menu, this dropdown shows the list of workflow variables.
Select Workflow Data in the Source dropdown menu, select the variable name created in step 4 in the Field dropdown menu, and then click OK.
Click the equals link and then select the is less than link, as shown in Figure 20.11.
Click the this message hyperlink that appears in step 22. The link becomes a text field with an ellipsis (...) button and fx button next to it.
Click the fx button to open the Define Workflow Lookup dialog box.
Select Current Item in the Source dropdown menu and select Created field in the Field dropdown menu. The completed step is displayed in Figure 20.12.
Click Finish. This checks the workflow for errors, writes the workflow files, creates initiation forms, associates the workflow with the Announcements list, etc.
Now that the workflow files have been created and the workflow is associated with the SharePoint list, you can browse to a view of the list in the SharePoint site and then trigger the workflow to start. Remember that you specified that the workflow could be started manually or could be automatically started when an item is updated. To manually start the workflow, right-click the item in the List or Library view and then choose Workflows from the popup menu, as shown in Figure 20.13.
The Workflows page for the list item opens, which displays all the workflows associated with the list. Click the workflow you created in the previous steps to open the workflow initiation page that was created by SharePoint Designer. Clicking Start on the workflow initiation page starts the workflow on the selected item. The SharePoint list where you started appears after you click Start and the workflow initializes. A new column with the workflow name is displayed in the SharePoint list, as shown in Figure 20.14.
The value of this column for the list item displays the status of the workflow. When the workflow finishes, the status changes to Completed. Clicking the status link opens the Workflow Status Web page, as shown in Figure 20.15.
The workflow status displays the following information about the workflow instance:
Workflow Information: This section indicates the user who ran the workflow instance, the item on which it was run, and the start time and end time.
Tasks: If the workflow is designed to create tasks and assign them to users, you should see those tasks in this view.
Workflow History: This is a special list that stores information about any workflow-related events and errors. You can use SharePoint Designer to log messages into the workflow history list. As shown in Figure 20.15, the Log this message to the workflow history list workflow action creates a comment log in this section with the created date and time of the item on which the workflow created in the above exercise ran on.
While the logic for the workflow for the exercise in this section could have been implemented in many ways in Workflow Designer, this approach was used to help you understand some of the key internals of the SharePoint Designer workflows. The Folder List task pane in SharePoint Designer now shows a Workflows folder that contains a number of workflows files generated during the workflow creation process. The next section takes you through the various files that are created by SharePoint Designer to support the workflows.
3.15.17.1