TFS 1.0 does not allow you to prevent users from using iteration path nodes, e.g., a parent node. The WIT XML below shows a way to work around this.
For example, say your Iteration Paths are:
Project Root
+Parent Node 1
-Child Node A
-Child Node B
+Parent Node 2
-Child Node X
-Child Node Y
You may want users to only choose the child nodes and not either of the Parent Nodes or the Project Root. You can prevent their use by adding the following to your WIT:
<FIELD name="Task Iteration" refname="Custom.TaskIteration" type="String">
<HELPTEXT>Hidden field used to prevent users from setting improper iteration path values.</HELPTEXT>
<COPY from="value" value="Valid Path" />
<WHEN field="System.IterationId" value="10">
<COPY from="value" value="INVALID_Project Root" />
</WHEN>
<WHEN field="System.IterationId" value="20">
<COPY from="value" value="INVALID_Parent Node 1" />
</WHEN>
<WHEN field="System.IterationId" value="30">
<COPY from="value" value="INVALID_Parent Node 2" />
</WHEN>
<WHEN field="System.IterationId" value="9429">
<COPY from="value" value="INVALID_DevDiv Content and Intl_Rosario" />
</WHEN>
<PROHIBITEDVALUES>
<LISTITEM value="INVALID_Project Root" />
<LISTITEM value="INVALID_Parent Node 1" />
<LISTITEM value="INVALID_Parent Node 2" />
</PROHIBITEDVALUES>
</FIELD>
A few notes:
- The System.IterationID value is the ID for the Iteration Path node you want to prevent from being used. You can find this by adding the IterationID field to a query. Each iteration path node will have a unique ID specific to your TFS install.
- Do not include the Custom.TaskIteration field on the form.
- If a user chooses an invalid node, such as Parent Node 1, TFS will display an error that the Task Iteration field has an invalid value and will prevent the WIT from being saved. This error doesn't map to the Iteration Path field, which may cause some confusion. (See next point).
- In order to help users understand the error and how to fix it, use something like the following in the WIT form:
<Control FieldName="System.IterationPath" Type="WorkItemClassificationControl" Label="Task Iteration Path - must be 3 levels" LabelPosition="Left" />
- You can of course use whatever field name and refname you'd like. This one is chosen to help make the resulting TFS error more understandable.
Thanks to Doug Mortensen of the VSTS team for this solution