Udostępnij za pośrednictwem


Workflow Tips (Part I - Configurable Approvers)

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.

Build a Configuration List

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.

Create a “Set Workflow Variable” Activity

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.

  • Source: Choose the configuration list
  • Field: Choose the appropriate column from the configuration list
  • Source: Choose the column holding the key to your configuration data. If you took the default when building the list, this will be “Title”
  • Value: Enter a string that matches the key for the configuration data you want.

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.

Create a “Send an Email” Activity

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.

Comments

  • Anonymous
    August 03, 2006
    Here is an assortment of various 2007 Microsoft Office SharePoint Server Documentation / Reference Materials...

  • Anonymous
    November 13, 2006
    I have been asked for a number of references that would be valuable for someone just getting started

  • Anonymous
    May 15, 2007
    Any thoughts on how you can send to multiple people in a Sharepoint list (e.g. list of board members that want to be notified when a document gets posted)

  • Anonymous
    June 24, 2007
    Hi Mark, I have a workflow to send an email. The "To" is getting the email formed from the colmuns of a custom list in sharepoint portal. I am using String Builder for this purpose. Now the problem is that the workflow is getting completed successfully, but there is no Email being received by the recepient :-( I am also trying to look for the History log but there seems to be no entries getting logged. Can you throw some light on this. I need to get this working. Thanks !!! zullu.

  • Anonymous
    October 24, 2007
    2007 MOSS Resource Links (Microsoft Office SharePoint Server) Here is an assortment of various 2007 Microsoft