sharepoinTony

@info – The practical side of SharePoint

Archive for March, 2009

Using alternate list data in a SPD Workflow.

Posted by sharepoinTony on March 27, 2009

Background:  MOSS 2007, SharePoint Designer 2007 used to create the workflow.

I have a user request workflow which is initiated when a new item is created in a user request list.  The user is required to select a ‘location’ when submitting the form (this form is used by many different locations in the USA).  Depending on the type of request an approval may be needed and I send an email to a designated approver based on the location that was selected by the user.   The user doesn’t know who the approver is and the support desk staff may or may not know either.  I currently am using hard-coded email addresses for the approvers in my workflow.  I ‘set’ a column with the email address once it is determined in the workflow and in later steps use that field in the email message.

What I would like to do is use another list to allow us to maintain the approvers, their appropriate email address, and the location where they are allowed to approve requests.

Here is how I did it:

  1. Edit my workflow in SharePoint Designer (SPD)
  2. Navigate to the appropriate step and conditional branch.
  3. Modify the “Set” field line,  selecting my  ‘other list’ as Source in the “Lookup Details” section of the Define Workflow Lookup window (note that this window opens when you select another list in the Source drop-down).
  4. Select the field in that source that I want used in the user request list for the Field selection of the Lookup Details section.
  5. Under “Find the List Item” section, I used the other list Location column in the Field selection.
  6. I then used the current list Location in the Value selection
  7. Click OK to close the Define Workflow Lookup window.
  8. Click YES to the warning (if it displays) that says “The lookup that you defined is not guaranteed to return a single value.” etc.. “Do you want to continue?”
  9. Finish your workflow to save and close the Workflow Designer window.
  10. Test it out – The appropriate approver is pulled from my “approval maintenance” list and placed into the current list item in my user request list!

This took me a little effort to figure out, it isn’t clearly documented and I couldn’t find it in the SPD help.  Maybe someone else will be able to use this, and shortcut their search effort to figure out how to do this kind of lookup in a workflow.

Advertisements

Posted in Designer, SharePoint Links, Workflow | Tagged: , , | 2 Comments »

Change List in Designer Form

Posted by sharepoinTony on March 10, 2009

Recently I created a request form in SharePoint Designer 2007 which was to be used to create a new item in a SharePoint List on one of  my MOSS 2007 sites.  I worked to get the appropriate look and feel, layout, etc. on the form so that the form would be pleasing to the users.  Normal stuff, right?

Then I tested my form out.  Worked great, so I added a 3-state workflow to the list.

This workflow needed to simply notify someone when the first step occurred: after a user submitted the form, creating the new list item.  For this step I thought it would be nice if the user got an email automatically, telling them we recieved their request.   To accomplish this I wanted to use OOTB tools, so I simply selected the CreatedBy  for my Task Assigned To selection in the Task Details within my worklfow.  This allowed me to check the Include Task Assigned To checkbox under E-mail Message Details.  In the Body I placed a nice and friendly message to the user saying we got the request.  Dandy, this is quick and easy.

Not so much.

The first thing testing brought to light was that the URL link included in the email was broken.  My list name contained a space and the automatically generated url in the email stopped at the space, with the remainder of the url following the link in plain text.  Users would have to copy and paste the whole url in the browser to go check the list.   Since they might want to look at the status of the request by going to the list, I felt this needed to be remedied.

Hey, Change the list name…Settings, List Settings, Title, description and navigation.  Won’t work.  The name will appear to the user but the url stays the same.

Ok, just create a new list with a name that doesn’t have spaces.  I saved the list as a template, created a new list using the template and now we have a list that won’t generate a broken URL.  Solved.

Wrong.  Of course the Form is using the original list.  I searched to learn how to detach the list in Designer.   You may have better luck than me, but I couldn’t find a way to do it.  It would have been nice of Microsoft to include the capability for swapping out one list for another on a form, but they didn’t.  Or if they didn’t they didn’t make it easy to find.  I know, I know there would likely be column differences which would require some management and resolution.  Still, it seems like this would be used by more than me and more than once.

I finally went to the code and changed the List ID from the old list to the new list’s ID using Replace in Designer.  This worked fine.  Now my effort on the form didn’t have to be repeated just because I needed to change the name of the list.

Testing proved my point…but another issue came up.  Now my user is getting email’s from the Workflow Tasks list as well.  Since they are the Assigned To person for the task, they get an email…and wonder what task they have to complete.  So I have to modify the workflow to stop using Created By as the Assigned To in the Workflow Task.  That is easy enough, but now I am back at square one.  I still want to generate an email to the requestor, but that will wait until tomorrow.  🙂

Posted in Lists, SharePoint 2007 | Tagged: , , | Leave a Comment »