TFS 2010 E-mail alerts sometimes don't have "Changed Field" section

Symptoms

You have Team Foundation Server 2010 SP1.  You have e-mail alerts set up.  When users change only one field in a Task or a Bug work item (other than the "Steps to Repro" field), the resulting e-mail does not have a Changed Fields section.  However, if users change two or more fields, the "Changed Fields" section appears in the e-mail.

Cause

This is a know bug in TFS 2010 SP1.

Resolution

If you look at C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\TFSJobAgent\Transforms\WorkItemChangedEvent.xsl on the TFS 2010 Application Tier, you will see three sections similar to:

 

<!-- If a field is changed, System.ChangedBy will also be changed. That's at least 2 fields.

           If there is only one field in ChangedFields//Field, it must be System.ChangedBy, which will be ingored.

           So it's safe to use "count(/WorkItemChangedEvent/ChangedFields//Field) > 1",

           rather than count(/WorkItemChangedEvent/ChangedFields//Field) > 1 or (count(/WorkItemChangedEvent/ChangedFields//Field) = 1 and /WorkItemChangedEvent/ChangedFields//Field[1]/ReferenceName[.!='System.ChangedBy'])

        -->

       <xsl:if test="boolean(/WorkItemChangedEvent/TextFields/TextField) or count(/WorkItemChangedEvent/ChangedFields//Field) > 1">

 

That logic is no longer valid since  ChangedDate is excluded from the list of changed fields because it’s a computed column.

 
Perform these steps to fix the code:

  1. Make a copy of the C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\TFSJobAgent\Transforms\WorkItemChangedEvent.xsl file and save it as a backup. 
  2. Replace “ChangedFields//Field) > 1” with “ChangedFields//Field) > 0” everywhere in the new file.
  3. Save this modified file with its original name in the same folder.
  4. Run a test to see if the e-mails have the proper data.

Properties

Article ID: 2706470 - Last Review: 25 Apr 2012 - Revision: 1

Feedback