Messing up TFS with LinkControls and Fields

I recently stumbled across a interesting case using TFS 2010 where you could end up unintentionally setting a field on a work item that is not supposed to use the field at all. This is probably best explaned with a simple example.

Lets say you team project is based on the MSF for Agile v5 template. You want to modify the Task WIT so that the LinkControl in the Links tab includes a column for severity. This way, whenever a Task is linked to a Bug you will know the severity of the bug without opening it up. Perfect! Lets do it!

I’ll skip the details of how to do this, the interesting part is that even though Task does not use the field Severity you will need to add it to the Task WIT in order to show it as a column in the LinkContol. Name, Field type and Ref name must be identical to what is used in the Bug WIT. And this is where you might make a small but potentially very annoying mistake. If you also copy the rules of this field from the Bug WIT (easily done if you copy/paste between XML-files or if you are just very thorough and decide to specify the field exactly as it is on the Bug WIT) all your Tasks will from now on be asigned the severity level “3 – medium”.

And why is this bad? Well, you’ll probably not notice it for some time. If you are lucky you wont ever notice it and if so, good for you! But chances are that sooner or later someone will get a very wierd result from a work item query or report. Lets say you have a report that counts the number of bugs of each severity level. Depending on the laziness of the person who designed the report, it might not check the work item type because only bugs used to have a severity level… and now this report is telling you that the number of bugs of severity level “3 – medium” is increasing at an alarming rate!

Good news is this that the mistake is fairly easy to solve. Remove all rules for the severity field on the Task WIT, create a query to return all tasks with severity “3 – medium”, export to excel, remove severity value from all tasks and publish the changes back to TFS. Done! Unless your report keeps track of history as well…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s