Compose Assigned To alert

May 9, 2012 at 11:08 AM
Edited May 9, 2012 at 2:42 PM

How would I compose a filter for Assigned To Changes - e.g. when a task is assigned to a user or assigned to another user?

Thanks!

May 10, 2012 at 7:59 AM

You need two alerts:

<!-- 1) Notify AssignedTo Work Item Changes -->

 <alert

       name="Notify AssignedTo Work Item Changes"

       event="WorkItemChangedEvent"

       filterExpression="$&quot;CoreFields/StringFields/Field[ReferenceName='System.AuthorizedAs']/NewValue&quot; &lt;&gt; $&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue&quot;">

 

       <recipients>

             <recipient

                    name="AssignedTo"

                    address="CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue"

                    type="DisplayNameField"

                    allowHtml="true"

             />

       </recipients>

</alert>

 

<!-- 2) Notify on change AssignedTo to another user -->

 <alert

name="Notify on change AssignedTo"

event="WorkItemChangedEvent"

filterExpression="$&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue&quot; &lt;&gt; $&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/OldValue&quot; AND $&quot;CoreFields/StringFields/Field[ReferenceName='System.AuthorizedAs']/NewValue&quot; &lt;&gt; $&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/OldValue&quot;">

 

       <recipients>

             <recipient

             name="PrevAssignedTo"

             address="CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/OldValue"

             type="DisplayNameField"

             allowHtml="true"

       />

       </recipients>

</alert>

May 10, 2012 at 12:07 PM

Hey Alix

Thank for the quick reply! Works great!

/Jasper

May 10, 2012 at 1:52 PM

For some reason it sends alerts on all changes now - (edits, checkins etc). Can it be configured to only send e-mails when the assigned to is changed?

Thanks in advance!

/Jasper

May 11, 2012 at 6:57 AM

Replace first alert by new below:

<!-- 1) Notify new user on change AssignedTo -->

 <alert

name="Notify new user on change AssignedTo"

event="WorkItemChangedEvent"

filterExpression="$&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue&quot; &lt;&gt; $&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/OldValue&quot; AND $&quot;CoreFields/StringFields/Field[ReferenceName='System.AuthorizedAs']/NewValue&quot; &lt;&gt; $&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue&quot;">

 

<recipients>

<recipient

name="NextAssignedTo"

address="CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue"

type="DisplayNameField"

allowHtml="true"

/>

</recipients>

</alert>

May 11, 2012 at 7:08 AM

Hi Alex - Same thing - If I write in the description field (or any other field) and save, I get an e-mail sent. Any Thoughts?

May 11, 2012 at 7:08 AM
Edited May 11, 2012 at 7:08 AM

double post

May 11, 2012 at 7:47 AM
jnus wrote:

Hi Alex - Same thing - If I write in the description field (or any other field) and save, I get an e-mail sent. Any Thoughts?

You need delete alert "Notify AssignedTo Work Item Changes".

May 11, 2012 at 8:15 AM
Edited May 11, 2012 at 8:16 AM

Yeah - I'm pretty sure I have the proposed configuration. The only 2 alerts in the config file now is:


 

<!-- 1) Notify new user on change AssignedTo -->

<alert
name="Notify new user on change AssignedTo"
event="WorkItemChangedEvent"
filterExpression="$&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue&quot; &lt;&gt; $&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/OldValue&quot; AND $&quot;CoreFields/StringFields/Field[ReferenceName='System.AuthorizedAs']/NewValue&quot; &lt;&gt; $&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue&quot;">
<recipients>
<recipient
name="NextAssignedTo"
address="CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue"
type="DisplayNameField"
allowHtml="true"
/>
</recipients>

</alert>			
<!-- 2) Notify on change AssignedTo to another user -->
 <alert
name="Notify on change AssignedTo"
event="WorkItemChangedEvent"
filterExpression="$&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue&quot; &lt;&gt; $&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/OldValue&quot; AND $&quot;CoreFields/StringFields/Field[ReferenceName='System.AuthorizedAs']/NewValue&quot; &lt;&gt; $&quot;CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/OldValue&quot;">
<recipients>
             <recipient
             name="PrevAssignedTo"
             address="CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/OldValue"
             type="DisplayNameField"
             allowHtml="true"
       />
       </recipients>
</alert>		

 

Still get notified when changing the description field.

May 11, 2012 at 8:20 AM

Remove all alerts and try again change the work item. I think you receive standard TFS alerts, not from Team Alert.

May 11, 2012 at 8:24 AM

Removed all alerts and no e-mails. Any other thoughts?

May 11, 2012 at 8:58 AM

I have not more thoughts. See filterExpression in alerts. Posted alerts have only condition on change AssignedTo field. If field AssignedTo not changed than alert not will sent.

Jul 31, 2012 at 3:17 AM
Edited Jul 31, 2012 at 3:20 AM

The example below shows how to send email reminders to newly assigned  users for a specified project.
The configuration is based on the original, but stripped of all alerts other than the "assigned to" alert.

This configuration bypasses what I believe to be a bug in the code which doesn't allow you to use the <> (not equal to) characters as is standard throughout TFS. 

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="teamAlert" type="Dymetis.TeamAlert.Configuration.TeamAlertConfigurationSection, Dymetis.TeamAlert"/>
  </configSections>

  <teamAlert>

    <!--
    Settings for sending notifications, optional.
      emailEnabled - true or false; default to true.
      smtpServer - SMTP server name; default to settings in TFS.
      fromAddress - notification sender address; default to settings in TFS.
      xslSearchPath - location of XSL transforms; default to TFSJobAgent\Transforms folder.
    -->
    <alertSettings />
    
    <alerts>
	<!-- PROJECT: ENTER PROJECT NAME HERE      - Send notification email to user who this work item has been assigned to -->
	<alert
  	  name="ENTER NAME OF ALERT HERE"
	  event="WorkItemChangedEvent"
	  filterExpression="$&quot;PortfolioProject&quot; = 'ENTER TFS PROJECT NAME HERE' AND
	 		     NOT($&quot;ChangedFields/StringFields/Field[ReferenceName='System.AssignedTo']/OldValue&quot; = $&quot;ChangedFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue&quot;)�">
	<recipients>
		<recipient
		 name="AssignedTo"
	 	 address="CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/NewValue"
		 type="DisplayNameField"
		 allowHtml="true"
		 />
	</recipients>
      </alert>
    </alerts>
  </teamAlert>
</configuration>

The biggest problem I found after reviewing the source code, is that there is no process handling for the  <> string (not equals to).

So you have to change the <>  with a NOT(fieldA = fieldB) 

Also note that the ChangedFields/StringFields/Field node is used instead of the CoreFields/StringFields/Field


Hope my two days of problem solving has helps you out!

 

Thanks for the plugin, it works wonders and is extremely easy to implement once you get the hang of it.  
The easiest way for me to find the right filterExpression is to:

1) Open Alerts Explorer and create a new alert that's close to (or exactly what you want)
2) Select the FilterExpression tab and copy the text displayed
3)  HtmlEncode the text (I use this very helpful site (http://www.string-functions.com/htmlencode.aspx)