How to prevent people from opening new bugs

We’re in the middle of transitioning to a new team project.  On the source control side, Microsoft has made a huge investment to support arbitrary renames throughout the tree.  No reason to mess with TFS->TFS migration when I can move the native items!  On the other hand, migrating work items across team projects is notoriously tricky.  I decided it would be easiest to steadily phase out the work items remaining in the old project while forcing people to open new issues in the new project.

Being relatively new to WIT customization, the answer wasn’t immediately obvious.  TFS doesn’t let you stick an ALLOWEDVALUES rule on fields like System.CreatedDate that the system populates on creation.  And anything you stick on a user-editable field will inevitably block users from navigating an existing work item through the rest of its legitimate workflow.  The path I took was modifying the initial transition from “”.  XML excerpt:

<TRANSITION from="" to="Active"> <REASONS> <REASON value="Build Failure" /> <DEFAULTREASON value="New" /> </REASONS> <FIELDS> <FIELD refname="Microsoft.VSTS.Common.ActivatedBy"> <COPY from="currentuser" /> <VALIDUSER /> <REQUIRED /> </FIELD> <FIELD refname="Microsoft.VSTS.Common.ActivatedDate"> <SERVERDEFAULT from="clock" /> </FIELD> <FIELD refname="System.AssignedTo"> <DEFAULT from="currentuser" /> </FIELD> <FIELD refname="System.Title"> <ALLOWEDVALUES> <LISTITEM value="Before 2009-02-12" /> </ALLOWEDVALUES> </FIELD> </FIELDS> </TRANSITION>

Most of this comes from the stock MSF Agile v4.2 template; the System.Title field with the strange rule toward the end is my addition.  Doesn’t really matter what you put in the value, so long as you don’t tell your users what it is :)

Leave a Reply