I am working on getting a community site up to host these articles as well as the code. My hope is that all interested developers will contribute their solution to the various Actions that can be selected in SharePoint designer.
This post is the first in a series. The series will discuss the porting steps as we presented in Seattle, but with the details filled in. (We had only 75 minutes to present, which is way too little.) Part 1 will discuss the virtual machine setup and the creation of the SharePoint Designer workflow that will be ported.
Virtual Machine Setup
When a workflow is created in SharePoint Designer, the site is updated with a few pieces that enable it to work. We want to ensure that we port all of these pieces, so we will be using two different web applications. The first at http://spdflow will be used for the SharePoint Designer workflow. The second at http://vsflow will host the Visual Studio workflow. Rather than use different port numbers for the web application, the hosts file (C:\WINDOWS\system32\drivers\etc\hosts) is updated with each of these host names.
The virtual machine will also have the necessary applications installed: SharePoint Designer 2007 and Visual Studio 2005 with the Office SharePoint Server 2007 SDK.
We will use SharePoint Designer to create a workflow. The workflow will perform the most popular actions -- collecting data, creating a task and writing to the history list. This is accomplished via the following steps:
- In SharePoint Designer, open the site http://spdflow.
- Click File | New | Workflow. The Workflow Designer wizard is displayed.
- Name the workflow SPDFlow and attach it to the Announcements list. Leave the start options at the default, which is manually. (We'll be starting it often.)
- Click on the Initiation button on the bottom
- Add a Workflow Initiation Parameter named InitiationField with a default value of Barracuda. Then click OK
- Back in the Workflow Designer wizard, Click Next.
- In Step 1, click on the Conditions button and choose Compare Announcements field.
- Choose the Modified By field and the account name of the current user.
- Click on the Actions button and choose Collect Data from User.
- Click on the "data" link to invoke the Custom Task Wizard.
- Enter "Collect Data Task" for the task name and click Next
- Click Add to create a field.
- Name the field "TaskField" and enter a default value of "DeliverPoint"
- Click Finish on the Custom Task Wizard. You will receive a warning about running instances, which can be ignored.
- Click on the "this user" link in Step 1 Actions. Select the account name for the current user.
- Click on the "Variable: collect" link in Step 1 Actions. Rather than put the data in a generically named variable called "collect," choose "Create a new variable" and name it "ListItemID"
- Click on the Variables button at the bottom of the Workflow Designer form. Even though we did not choose the variable named "collect," it was created for us. Remove it, and any other unused variables, from the list.
- Click Finish.
SharePoint Designer will save the workflow and associate it with the Announcements list. Test the workflow by returning to the browser and navigating to the Announcements list.