Jon Gallant

How to Validate Area & Iteration Paths in TFS

2 min read
  1. 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

    1. Create a new query:

6064.image 5F00 thumb 5F00 342A4F25

    1. Select the AreaId and IterationId columns

2337.image 5F00 thumb 5F00 3EE7A67A

    1. Run query. Record both the AreaId and IterationId.

6545.image 5F00 thumb 5F00 0C83D2FB

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

6457.image 5F00 thumb 5F00 1336DC7E

  1. Select the Type you want to validate:

4807.image 5F00 thumb 5F00 4BE1868B

  1. Save it locally:

6052.image 5F00 thumb 5F00 1D8800DE

  1. Open in Notepad

  2. 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)

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

<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>
  1. Save the file.

  2. Import the modified file into TFS using the Power Tools:

8611.image 5F00 thumb 5F00 041FFDA4

  1. Select your file and Project. Click OK.

2656.image 5F00 thumb 5F00 51BC2A24

HTH,

Jon

Share:
Share on X