How to Validate Area & Iteration Paths in TFS

0) Run a TFS query to find the AreaId and IterationId that you don’t want to allow. In my case it was 489 for both Area and Iteration

0.1) Create a new query:

0.2) Select the AreaId and IterationId columns

0.3) Run query. Record both the AreaId and IterationId.

1) Export the Work Item using the TFS Power Tools. Tools->Process Editor->Work Item Types –> Export WIT

2) Select the Type you want to validate:

3) Save it locally:

4) Open in Notepad

5) Scroll down to the end of the field definitions: (I like to put at the end, but you can put where ever you want to)

6) Paste the following snippet right after the last FIELD definition. REPLACE 489 with your own number.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<FIELD name="Work Item Iteration" refname="Custom.WorkItemIteration" 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="489">
<COPY from="value" value="Project Root" />
</WHEN>
<PROHIBITEDVALUES>
<LISTITEM value="Project Root" />
</PROHIBITEDVALUES>
</FIELD>
<FIELD name="Work Item Area" refname="Custom.WorkItemArea" type="String">
<HELPTEXT>Hidden field used to prevent users from setting improper area path values.HELPTEXT>
<COPY from="value" value="Valid Path" />
<WHEN field="System.AreaId" value="489">
<COPY from="value" value="Project Root" />
</WHEN>
<PROHIBITEDVALUES>
<LISTITEM value="Project Root" />
</PROHIBITEDVALUES>
</FIELD>

7) Save the file.

8) Import the modified file into TFS using the Power Tools:

9) Select your file and Project. Click OK.

HTH,

Jon

Share