This blog posting applies to Microsoft Office SharePoint Server 2007.
Using SharePoint Designer (SPD), it’s possible to create a workflow that can look up a user’s identity from a SharePoint list in order to send email to the user and collect feedback from the user. This technique can be used to make a workflow more flexible, and also to cover the scenario where a workflow participant changes jobs or leaves the company. In this case, a different user can be configured as the workflow participant without having to modify the workflow itself.
As an added benefit, this technique also extends SharePoint’s link fixup behavior to workflows so libraries can be moved without breaking workflow links.
First, create a custom list to store information about workflow participants. The Site Info list in the next figure keeps track of a Content Editor, a Content Approver and the URL of the site. We will retrieve this information using the Site Name, which matches entries in this list (but does not have to match information in the site itself).
For the user columns, pick the User or Group type (of course), then change the value displayed to Name, because the default is Name (with presence) and this doesn’t work.
Now we can build the workflow. Fill in the first screen of the wizard with a title, list and initiation of your choice.
It’s best to begin by retrieving the value(s) you want from the list into workflow variables. This is especially true if you will use them more than once, but even if you just use the value one time, it’s a good practice to put it in a variable for easier maintenance and extensibility of the workflow.
Create a new “Set variable to value” activity, and choose a name for your variable. Then, for the value, click the f(x) button and fill in the wizard as follows.
This says “Retrieve the Content Editor field from the Site Info list for the entry whose Site Name equals Consulting.” You can ignore the warning about only returning the first item. But take this as a reminder that it only makes sense to use unique keys in your configuration list.
That’s all there is to it! Another step is shown to provide a meaningful example.
The next step is to send an email to the Content Editor, with a link to open their task library to approve or reject the content. The To: field in the email is set by a workflow lookup to the ContentEditor variable that was just created.
In the body, we are using a lookup to a new variable we created like the other lookup; this one is for SiteUrl so we don’t have to hardcode that into the workflow.
An important benefit of this is that if the site is moved to another location in the SharePoint hierarchy, the Site Info list will have its links fixed up, and the workflow will continue to work without modification!
This example will continue in another posting to discuss getting feedback from the ContentEditor user after they have completed their edit and wish to kick the workflow to the next step.