Let’s assume that the built-in TFS standard templates are not sufficient for you. You’re in luck: TFS allows you to create your own custom work item. Let’s imagine that, for some reason, you want a work item type called “Defect”, rather than “Bug”. Here’s the process, based on the “Bug” work item type.
First thing is to open the command prompt in administrator mode, and navigate to a work directory; for example, the “Documents” folder . Then export the template work item type, like so (you can export the entire definition of all work items, but it becomes unmanageable):
[code lang=“DOS”] witadmin exportwitd /collection:http://tlaptop:8080/tfs/DefaultCollection /p:“TFSSandbox” /n:Bug /f:Defect.xml
[![customwi1](http://pmichaels.net/wp-content/uploads/2016/11/CustomWI1-300x69.png)](http://pmichaels.net/wp-content/uploads/2016/11/CustomWI1.png) Check your working directory: [![customwi2](http://pmichaels.net/wp-content/uploads/2016/11/CustomWI2.png)](http://pmichaels.net/wp-content/uploads/2016/11/CustomWI2.png) Now, open the XML file. I used Notepad++, but you can use Notepad or vi, or whatever. To change the work item, change the name attribute; once you've done this, you have a new work item type: [![customwi3](http://pmichaels.net/wp-content/uploads/2016/11/CustomWI3-300x80.png)](http://pmichaels.net/wp-content/uploads/2016/11/CustomWI3.png) Now, you can add the fields that you want. I'm adding a field called "pcm.CustomField": [code lang="XML"] <?xml version="1.0" encoding="utf-8"?> <witd:WITD application="Work item type editor" version="1.0" xmlns:witd="http://schemas.microsoft.com/VisualStudio/2008/workitemtracking/typedef"> <WORKITEMTYPE name="Defect"> <DESCRIPTION>Customised defect</DESCRIPTION> <FIELDS> <FIELD name="Iteration Path" refname="System.IterationPath" type="TreePath" reportable="dimension"> <HELPTEXT>The iteration within which this bug will be fixed</HELPTEXT> </FIELD> <FIELD name="New Field" refname="pcm.CustomField" type="Integer" /> <FIELD name="Iteration ID" refname="System.IterationId" type="Integer" />
The field name attribute (“New Field” in this case) tells TFS how to refer to this field to the user. This is important, because if you forget that you’ve called it “New Field”, you might assume this hasn’t worked and start googling to find out why.
Now you’ve told TFS that you have a field to store; the next step is to add that field to the layout: