Add a Hyperlink to Work Item Changed Alert Email

I was tasked to customize the email that was sent out when an alert has been set up to send an email on a work item changed event in Team Foundation Server 2012 (TFS2012). The customization was to add a static link to the work item, which is actually a good lead into doing more advanced customizations on the email template files (XSL files).


On the application tier of TFS2012 you will need to locate the WorkItemChangedEvent.xsl file. This is what builds the email that is sent out if there is an alert set up for a work item change. You can locate this file at:

C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\TFSJobAgent\Transforms\1033

There is a plain text version of the file, but I prefer to edit XML-based documents in Visual Studio, so go ahead and open it up in the editor of your choice. Because hyperlinks are used in a lot of the email templates there is already an XSL template for displaying an HTML hyperlink in alert email. Here is the snippet of code to add a hyperlink to Bing.

<xsl:call-template name="link">
  <xsl:with-param name="format" select="'html'"/>
  <xsl:with-param name="link" select="''"/>
  <xsl:with-param name="displayText" select="'Bing'"/>

Below I added the highlighted snippet of code just above the footer in the work item changed event XSL document.


Note that I also put an HTML break tag in there. I added this so that it separates from the table that is defined just above it in the document. After changing this, you should not have to recycle, or restart, IIS as it should be automatically picked up. Once saved, I created a simple alert to send an email whenever there is a work item changed event on the FabrikamFiber project of the Brian Keller virtual machine and created a new task. Below is what the email looks like after my customization.


About the Author:


  1. Salam Elias February 9, 2013 at 9:34 am

    Is it possible to get some values dynamically and build the link accordingly? What I mean for example build a link to a documents related to the changed work item that lands the developer on a document in sharepoint where he can read something…..

  2. James Tupper February 18, 2013 at 5:48 pm

    Yes, it is totally possible to add data from the fields in the changed work item(s). As for building a link from documents linked to the work item, I do not have a specific example. I will look more into this and let you know what I find.

  3. sathish December 24, 2014 at 2:10 am


    Nice post.. Possible to add logo image on footer and possible to change email subject based on work item field dynamically

Leave A Comment