Wednesday, March 30, 2011

Embedding a link to a printable list item in a workflow email.

When you create a workflow based on a list item, such as sending an email after an item has changed, it is useful to have a link within that email that links back to the list item. It would be even better to have a link back to a printable version of that list item.

The default link creation tool in SharePoint Designer workflows however doesn't work. If you attempt to add a link using the SharePoint designer field created for that purpose, you will end up with a link that connects do nothing and doesn't work.
So how do you create a link back to the list item that does work, with a printable version of the list item?

Open your existing workflow or create a new one.

Set up all of your conditions as necessary, and then set up the "Send Email To" action, filling out fields as appropriate.

In the body of the email, to link to the original list item, do the following:

1. Type in the text in your email that will be the link to your item, such as "View Test Case" or "View List Item". Highlight the text and click the hyperlink button.

2. "Text to display" will already be filled out if you highlighted your text, if not, fill out the text you wish your link to be associated with. Then, in the address section, click the String Builder button (3 dots).

3. Build the link in the following way:
- Start with the URL of your SharePoint server, egs. https://yoursite.gov.bc.ca. Note the lack of trailing slash.
- Click "Add or Change Lookup"
- In the data source field, choose "current item".
- in the field from source field, choose "Path"
- Leave the "return field as" field to its default, "As String"
- Click ok to build the first part of the url
- Append the following text to the URL "/DispForm.aspx?ID=" This must be EXACT including the beginning slash
- Click "Add change or lookup"
- Data source is current item
- Field from source is "ID"
- Click OK.

The URL that you have created should now look something like:
https://yoursite.gov.bc.ca[%Current Item:Path%]/DispForm.aspx?ID=[%Current Item:ID%]
Ensure all slashes and naming of the DispForm part are IDENTICAL.
Click "ok" then "ok" again.

Your workflow email will now have a link that links to a printable version of the list item.

No comments:

Post a Comment