In our last post in this series, Gregg blogged about forcing selection of reason. Let’s take a look at another question that we often get: “How do I deactivate/retire a work item type? I don’t want to destroy the type because I want to report on it, but I don’t want others to create new work items of this type”.
Using a similar approach to the previous workarounds:
- Create a DeactivatedType field as part of the type you want to deactivate
- Add the following rules to the field:
<FieldDefinition type="String" name="Deactivated Type" refname="Demo.DeactivatedType">
<COPY from="value" value="This work item type has been deactivated. Use Bug type instead." />
<LISTITEM value="This work item type has been deactivated. Use Bug type instead." />
Now, add this field to the form definition. Make it prominent, let’s put it at the top of the form. Here’s how the form would look like when a user tries to create a work item of this type:
This workaround works by copying a value to our new field that violates the prohibited values rule, so the new work item cannot be saved. This achieves the net result that your type hasn’t been deleted but work items of this type cannot be created.
Program Manager, Team Foundation Server
[Update 3/31/2009]: Cross-posted on http://blogs.msdn.com/sunder/