Home Contact

The Frog Pond of Technology

Ripples of Knowledge for SharePoint and Other .Net Technologies

News

 Subscribe to this blog


Brian's new book

About Me

Name:
Brian T. Jackett
Location:
Columbus, OH
Company:
Microsoft

Find me on...

Twitter












Tag Cloud


Archives

Post Categories

Syndication:

SharePoint Designer 2010 Workflow Email Link To Item

    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.

Problem

    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.

Solution

    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.

EmailLink1

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.

EmailLink2

Your Edit Hyperlink dialog should now look something like this.

EmailLink3

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).

EmailLink4

Conclusion

    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.

 

      -Frog Out


Friday, February 18, 2011 1:30 PM

Feedback

# re: SharePoint Designer 2010 Workflow Email Link To Item

I was stuck for hours on "CurrentItem" then I found this entry and thanks to you now I know it should be "WorkflowContext" :)

Thanks!
4/29/2011 1:59 AM | Jed Mallen

# re: SharePoint Designer 2010 Workflow Email Link To Item

Jed,
I ran into the same issue at first. Glad to help you out.
4/29/2011 11:29 AM | Brian Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

in SP 2010 WF do you know the syntax to add a link that would be
UrL/Forms/EditForm.aspx?ID= Current list - ID
&(Current List ) Source ( http etc)
&( Current List) ContentTypeId

I do not know how to add the &s in using the auto link selection. 5/2/2011 11:06 AM | dave

# re: SharePoint Designer 2010 Workflow Email Link To Item

How do you do this in SPD 2007?
There is no option to add a link
is there another way to do this? 5/19/2011 9:35 AM | saud

# re: SharePoint Designer 2010 Workflow Email Link To Item

Saud,
Since there is no action to "add a link" in SPD 2007 you may want to try building the hyperlink () as a dynamic string and insert that into the body of the email. I haven't gotten a chance to try this myself, but let me know if that works for you.
5/23/2011 9:24 AM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

Thanks Heaps, works brilliantly!! 6/30/2011 9:59 PM | Tamms

# re: SharePoint Designer 2010 Workflow Email Link To Item

Thank you for the tip. It saved my day. :-) 8/8/2011 1:31 AM | Srikanth

# re: SharePoint Designer 2010 Workflow Email Link To Item

Waht if you wanted to add a link in the body to a item on another list, just not the current list? Ideas 8/22/2011 1:47 PM | Poled

# re: SharePoint Designer 2010 Workflow Email Link To Item

Thanx for the tip! The URL is placed as expected ...

One question/issue.... The List Name has a space in it .. "Trouble Ticket"

When the URL is put into the email, the space breaks up the hyperlink of the URL and breaks it ... No %20 is placed in the link name to account for the space...

Any way around this?

Jeff
8/22/2011 2:30 PM | Jeff LHuillier

# re: SharePoint Designer 2010 Workflow Email Link To Item

Poled,

If you want to use another list you will lose the "Current Item URL" context. Instead you will need to build the URL manually / semi-manually. Read through this forum post for help on how to do that.

http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/333909e5-da8f-4d91-adb1-02a525553a0e
8/29/2011 10:33 PM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

Jeff,

Did you change the name/URL of your list after creation? I created a sample list with spaces in the name, sent an email with link to that list, and got the proper "%20" to replace the spaces. Clicking the link successfully brought me to the item.
8/29/2011 10:35 PM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

Worked great! Saved me lots of time trying to figure this out on my own.... Thanks!!!! 9/19/2011 12:34 PM | Bob

# re: SharePoint Designer 2010 Workflow Email Link To Item

Nice work ..
Its working perfectely in SP 2010. 9/29/2011 1:59 AM | Neel

# re: SharePoint Designer 2010 Workflow Email Link To Item

What if the ID you are trying to retrieve is from the task list? I have a workflow that is attached to a form library. When a form is submitted to the library it kicks off a task item. I want to include a URL to that task item in the email that is sent out in the form library workflow. All the blogs and suggestions I have read is based on the workflow running on the Task List, so the ID lookup is automatically inherited.

Do you know how to get the ID in my situation? I have been hitting my head on the wall about how to get this done. Also, a concern that i have is that even if I get it done, will there be a sychronization issue since I notice the workflow fires of the email immediately even before the task item is created?

Thanks,
9/30/2011 3:07 PM | Arnel

# re: SharePoint Designer 2010 Workflow Email Link To Item

Arnel,

You could create 2 workflows. The first workflow runs on your form list and creates an item in the tasks list. The second workflow could then run on the tasks list when an item is created. The task list workflow would use the emailing functionality described in this post to send out a URL to the task item. This should also take care of the issue with the task item existing before sending an email.
10/4/2011 10:27 PM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

Thx a lot. Your post saved me loads ot time.

Works great. 10/5/2011 10:52 AM | Kurt

# re: SharePoint Designer 2010 Workflow Email Link To Item

Thanks dude...Good post!!! 10/7/2011 2:25 PM | Kumar

# re: SharePoint Designer 2010 Workflow Email Link To Item

That's ace! Is there anyway of including a 'preview' of the current item in the message body 10/11/2011 10:19 AM | rooey

# re: SharePoint Designer 2010 Workflow Email Link To Item

Rooey,

Depending on the content type you are working with you should be able to include a "preview". In the case of an item on a custom list you can include a lookup to the title field and perform a substring on it for the first X number of characters.
10/11/2011 8:18 PM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

Do you know of any way to make the link use the modal popup version of the form?

I also notice that when you select "Close" at the bottom of the item after following the link, you automatically go to the "All Items" view of the list the item came from. Any idea how to make it go to one of the other created views instead? Is it simply whichever view is set as the default view? 10/13/2011 5:31 PM | Nathan A.

# re: SharePoint Designer 2010 Workflow Email Link To Item

Nathan,

I do not know of a way off the top of my head to send the modal popup version of the link. There may be one but you'd have to do some research. If you find a way please share.

As for the All Items display I assume that is because it is the default.
10/13/2011 7:50 PM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

Hey thanks for the tip.

Now i am stoned. I need to add an image into the email that the workflow is generating and sending as part of the notification process.
I have tried using the Advanced Features of "Send An Email" action to embed the image source in Sharepoint Designer 2010 all to no avail.
Any help as to how I could achieve that? 10/26/2011 12:07 AM | Nonso

# re: SharePoint Designer 2010 Workflow Email Link To Item

Nonso,

I'm not aware of any functionality to send an image in the email. Sorry I can't be of more help.
10/31/2011 11:02 AM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

How do I open the form in a browser on an email approval workflow? The link below requires InfoPath 2010 to review the form before approving. 11/11/2011 11:41 AM | Martin

# re: SharePoint Designer 2010 Workflow Email Link To Item

Martin,

The instructions I posted were tested against a custom list. Did you implement yours on a forms library? Sounds to me like what you are seeing. In order to view forms through the browser you must have SharePoint Enterprise and configure InfoPath Forms Server service running. Also your form must be browser enabled. Let me know if that is not the case.
11/13/2011 9:21 PM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

nice article 11/24/2011 4:14 AM | Vik

# re: SharePoint Designer 2010 Workflow Email Link To Item

You've saved me much time and aggrivation. Thanks!! 12/22/2011 8:04 PM | Paul

# re: SharePoint Designer 2010 Workflow Email Link To Item

Paul, glad I could help you out and save some frustration.
12/23/2011 11:06 AM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

This worked great, however, the item opens in read only, and is not editable and the edit button is dimmed. how can I turn on the edit icon so the supervisor can approve? thx 1/13/2012 8:48 AM | ruth

# re: SharePoint Designer 2010 Workflow Email Link To Item

Ruth,

The link I used goes to the display form for the list. If the user has appropriate edit permissions to the item then they should be able to click the edit item button. It sounds to me that your user only has view permissions since the edit button it dimmed.
1/18/2012 2:19 PM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

Hi, the current URL will link the internal address, any ideas how can I create a hyperlink that will have the same structure but have the link use our extranet address?

So for example it's currently http://<servername>/sites/department/document library when it I want it to display http://<external access name>/sites/department/document library.

Thanks 2/21/2012 10:09 AM | Fawaz

# re: SharePoint Designer 2010 Workflow Email Link To Item

Fawaz,

Using the above described process I don't believe it is possible to use the external (alternate access mapping) URL. You could create a custom SPD workflow action in Visual Studio, deploy to your farm, and then use that step in SharePoint Designer workflow to grab the external AAM URL. That would require a bit more development and configuration though.
2/25/2012 3:02 PM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

Brian,

Thank you for the reply and I will look into doing that or altering the default address to the http version of the same name. Since our farm is currently rather small I believe this can be done relatively easily but will test on my test farm first! :)

Thanks again. 2/29/2012 4:38 AM | Fawaz

# re: SharePoint Designer 2010 Workflow Email Link To Item

WOOOO HOOOOO! Thanks! It worked perfectly. 3/8/2012 3:42 PM | Henry Joseph

# re: SharePoint Designer 2010 Workflow Email Link To Item

Thank you! I was stuck before finding this. 3/15/2012 10:21 AM | iain

# re: SharePoint Designer 2010 Workflow Email Link To Item

This did not work for me because when it created the URL, it prefixed the URL with ntlm ie the website is sp.mywebsite.com and it delivered ntlm.mywebsite.com
Does anyone know how to deliver the correct URL.
Is it a setup issue?? 3/29/2012 10:30 AM | Peter

# re: SharePoint Designer 2010 Workflow Email Link To Item

Peter,

Are you using Alternate Access Mappings (AAMs) in your farm? It sounds like you have multiple zones configured and the default zone (ntlm) is being used instead of an intranet / custom zone. See my comment to Fawaz above. You would either need to change your AAM zones or create a custom solution to pull a specific zone rather than the default. Hope that helps.
3/29/2012 11:03 AM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

Hi Brain,

Thank you for your article, saved me alot of research time and headache. However there is one issue i am seeing using the CurrentItemURL. One of our wf is set to run when an item is created, and instead of linking direcly to the Current item's URL like the string says, it opens the allitems.aspx view. I tried a few instances and the same thing keeps happening. Any ideas/suggestions. Thank you for your help, really appreciate it. - Karan 4/17/2012 2:18 PM | Karan Patel

# re: SharePoint Designer 2010 Workflow Email Link To Item

Karan,

Is your workflow firing before or after the item is created (ItemAdding or ItemAdded)? If before then there is no item (and thus no URL) for it to interact with. If after then you should be able to get URL via that property.
4/19/2012 12:58 PM | Brian T. Jackett

# re: SharePoint Designer 2010 Workflow Email Link To Item

I was looking for this solution for quite some time before I stumbled onto your site. Worked like a charm. Thanks! 4/20/2012 4:48 PM | Greg

# re: SharePoint Designer 2010 Workflow Email Link To Item

Hi,
I was looking for the same and your post is so simple and accurate. Thanks for posting this. This solved my problem. 4/26/2012 5:28 PM | Nagendra

# re: SharePoint Designer 2010 Workflow Email Link To Item

Another thank you! Would be great if the body of the email could contain more info. A calendar event with the start/end date, etc. But this is great! 4/27/2012 2:50 PM | Tom

# re: SharePoint Designer 2010 Workflow Email Link To Item

Thank you very much. Your post was very helpful. Is there any way to link them to a page to approve or reject the item? 5/21/2012 10:12 AM | Tim

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: