Modify a date field according to another field

Mar 20, 2014 at 3:48 PM
Hi,

Is there a way to use TFS Aggregator to automatically update a Date\Time field according to the value of another field?

For example:
We have 3 Severity Fields:
  1. Low
  2. Medium
  3. High
Each severity should be dealt with within a specific amount of time.
For example Medium = 3 Days.

When Severity field = Medium, I would like the due date field to automatically calculate 3 days from now and adjust accordingly.

Thanks!
Mar 21, 2014 at 9:08 AM
"Out of the box" it is not possible.

But source code on your hands and it means that everything is possible! ;)

But this task a little harder than it seems at first.

Let's assume that you cat write a simple "String" trigger that will do something like this:
<TargetItem name="Amount of time"/> "
...
<Condition leftField="Severity" operator="EqualTo" rightValue="Medium"/>
...
<Mapping targetValue="$NOW$+3"/>

The main problem will be in possible infinite loop because no way to specify condition as you need.
Whenever any work item will set to "Medium" -> Amount of time will be incremented -> check: severity is Medium? "yes" -> Amount of time will be incremented -> ...
Or someone left comment -> Amount of time will be incremented -> Loop
Or someone link another work item -> Amount of time will be incremented -> Loop
...

So, to solve this nightmare you will need to realize new "ComparisionOperator.Changed" at least.
To realize this you will need to produce "WorkItemChangedEvent ev" to Compare function and check that your field is in ev.ChangedFields list.

When you do this you can set correct condition like this:
<Condition leftField="Severity" operator="Changed" />
<Condition leftField="Severity" operator="EqualTo" rightValue="Medium"/>

After that you will need to write new OperationTypeEnum.AddToDate (and handler function in Aggregator.cs) where you will parse targetValue="$NOW$+3".

Good luck! :-)