<Update: 2015-06-15> My colleague Joe Rodgers pointed out that the below steps do not work in SharePoint 2013 style workflows. As it turns out there was an issue with the link that was generated for the “Workflow Context: Current Item Url”. This issue is addressed in the SharePoint 2013 June 2014 CU (requires Service Pack 1 or the March 2013 PU). See below for more details.
In this post I’ll walk you through the process of sending an email that contains a link to the current item from a SharePoint Designer 2010 workflow. This is a process that has been published on many other forums and blogs, but many that I have seen are more complex than seems necessary.
A common request from SharePoint users is to get an email which contains a link to review/approve/edit the workflow item. SharePoint list items contain an automatic property for Url Path, but unfortunately that Url is not properly formatted to retrieve the item if you include it directly on the message body. I tried a few solutions suggested from other blogs or forums that took a substring of the Url Path property, concatenated the display form view Url, and mixed in some other strings. While I was able to get this working in some scenarios I still had issues in general.
My solution involved adding a hyperlink to the message body. This ended up being far easier than I had expected and fairly intuitive once I found the correct property to use. Follow these steps to see what I did.
First add a “Send an Email” action to your workflow. Edit the action to pull up the email configuration dialog. Click the “Add hyperlink” button seen below.
When prompted for the address of the link click the fx button to perform a lookup. Choose Workflow Context from the “data source” dropdown. Choose Current Item URL from the “field from source” dropdown. Click OK.
Your Edit Hyperlink dialog should now look something like this.
The end result will be a hyperlink added to your email pointing to the current workflow item. Note: this link points to the non-modal dialog display form (display form similar to what you had in 2007).
SharePoint 2013 Considerations (update 2015-06-15)
If you attempt to use this process for SharePoint 2013 style workflows (based on Workflow Manager and not the out of the box SharePoint 2010 workflow engine) you will notice that the URL generated is incorrect (ex. “Lists/MyList/1_.00”). It will look something like the following.
The solution to this is to install the SharePoint 2013 June 2014 CU (I tested with the Server package but it may be included in the Foundation package as well). After you install this cumulative update you may notice that the URL generated only includes from the list level and down (ex. “LIsts/MyList/DispForm.aspx?ID=1). As such you will need to combine this with the site URL. See below for example of the new URL that is generated.
In this post I walked you through the steps to create a SharePoint Designer 2010 workflow with an email that contains a link to the current item. While there are many other options for accomplishing this out on the web I found this to be a more concise process and easy to understand. Hopefully you found this helpful as well. Feel free to leave any comments or feedback if you’ve found other ways that were helpful to you.
Friday, February 18, 2011 1:30 PM