Logs of an SMS Administrator at myITforum.com

Losing Hair Daily in the Name of Technology

Syndication

Blog to Blog

Some of My Favorite Web Sites

July 2008 - Posts

I'm sure that there are people out there who have had this problem as I've seen a LOT of posts asking about the problems with this particular workflow lookup item, but no complete solutions which take into considerations one of the most common problems in SharePoint naming: spaces.

My experience comes from attempting to create a workflow action which emails the URL of the current item in a list. Using SharePoint Designer 2007, this seems to be a cut and dry process. Not so. Before I go into what needed to be done, let's review the lookup items and their results.

Encoded Absolute URL:

[%LISTNAME:Encoded Absolute URL%] - yields - http://INTRANET/SITENAME/Lists/LISTNAME/#_.000 

Server Relative URL:

[%LISTNAME:Server Relative URL%] - yields - /SITENAME/Lists/LISTNAME/#_.000

URL Path:

[%LISTNAME:URL Path%] - yields - /SITENAME/Lists/LISTNAME/#_.000

Now, the unassuming individual would think that pulling the Encoded Absolute URL from within a SharePoint workflow would provide a working link. It does not. There is one problem which will always occur and another which may occur, depending upon the naming convention you use for your lists.

Problem 1: ID number pulled from URL actions are appended with "_.000"

Problem 2: Spaces within list names are sometimes ignored, sometimes not. i.e.  "My Cool List" could be translated into "MyCool%20List" - causing a 404 error during the URL lookup.

Solution 1 is provided by Sondergaard at SharePoint Blogs:

http://www.sharepointblogs.com/peoplenet/archive/2007/05/10/moss-workflow-isn-t-always-a-walk-in-the-park-encoded-absolute-url.aspx

The solution, albeit correct, doesn't completely explain the process of building the URL so I'll fill in the blank spaces here. Creating the URL path involves some typing and inserting some lookup fields from the SharePoint Designer. Here is the example given by Sondergaard: (This would be put into the email body.)

This is a link to the <a href="http://intranet/[%LISTNAME:Path%]/DispForm.aspx?ID=[%LISTNAME:ID%]"> list item</a>  

The item "intranet" is the path to the root of your SharePoint site - "http://sharepoint.yourcompany.com/"

[%LISTNAME:Path%] is the lookup item from the workflow email message builder - "Current Item" (first selection) "Path" (second selection)

[%LISTNAME:ID%] is the lookup item from the workflow email message building - "Current Item" (first selection) "ID" (second selection)

Logic would say that you can type these items in and it would work, but I have yet to have success unless I go through the actual lookup selection process. I'm pretty new to SharePoint, so I don't have a reason for this - perhaps someone out there would like to post a comment to explain this piece. I would welcome it.

Solution 2 is to rename your lists to contain no spaces. Now, again, this would seem easy to do - enter your list settings, go to Title, description and navigation, and change the name. This will not work as it seems to only change a pointer for SharePoint references, but not anything that has to do with URL paths. You can see this within SharePoint designer if you browse the list items.

Example:

"My Cool List" renamed to "My_Cool_List" appears in SharePoint Designer as "My Cool List (My_Cool_List)"

You need to rename the list itself within SharePoint Designer to have one single list name. Right-click on the list item, select "rename" and rename the list to something without spaces. SharePoint Designer will save this information to your SharePoint site and references in all attached workflows will reflect these changes.

This method has succeeded for me - hopefully this will help others that are struggling with URL paths within SharePoint workflows.

Posted by mlucero | with no comments