How to: Add a Field to a Work Item Type
You can add a field to a work item type by exporting the XML file and modifying its content. As soon as you have added a field to the work item type, you can import the XML file to start to use the updated work item type.
Required Permissions
To perform this procedure you must be a member of the Team Foundation Administrators group or a member of the Project Administrators group for the project. For more information, see Team Foundation Server Permissions.
To add a field
If you are modifying a work item type on a single project, run witexport to export the XML file for the work item type you want to modify. For more information, see How to: Export a Work Item Type from an Existing Project.
In Visual Studio, click File, click Open, and then click File.
This displays the Open File dialog box.
Under Look in, move to the location where you exported the file.
If you are modifying a work item type to customize a process template, move to the location where you downloaded the process template.
Note
If you are running Windows Vista, you might not have access rights to certain folders. If you try to export the work item type to a location where you do not have access rights, the registry virtualization technology automatically redirects the exported file and saves it to the virtual store. For more information, see https://go.microsoft.com/fwlink/?LinkId=92325 and https://go.microsoft.com/fwlink/?LinkId=92323. To avoid this redirection, you can export the file to a location where you have access rights.
Select the work item type XML file that you want to update, and then click Open. When you are prompted about line endings, click No.
Find the following section of the XML file.
<FIELDS>
Create a new string field by typing the following XML, shown as highlighted in the following example.
<FIELDS> <FIELD name="Category" refname="MyCompany.MyProcess.MyField" type="String" reportable="Dimension"> </FIELD>
Note
The Reference Name, or refname, is the programmatic name for the field. All other rules should refer to this refname. For more information, see Field Reference Names.
Find the section of the XML file that describes the work item form.
<FORM>
Find the following lines in the <FORM> section.
<Group Label="Classification"> <Column PercentWidth="100"> <Control Type="WorkItemClassificationControl" FieldName="System.AreaPath" Label="Area" LabelPosition="Left" /> <Control Type="WorkItemClassificationControl" FieldName="System.IterationPath" Label="Iteration" LabelPosition="Left" /> </Column> </Group>
Insert a new control to display your field by typing the following XML shown as highlighted in the following example:
<Group Label="Classification"> <Column PercentWidth="100"> <Control Type="WorkItemClassificationControl" FieldName="System.AreaPath" Label="Area" LabelPosition="Left" /> <Control Type="WorkItemClassificationControl" FieldName="System.IterationPath" Label="Iteration" LabelPosition="Left" /> <Control Type="FieldControl" FieldName="MyCompany.MyProcess.MyField" Label="MyField" LabelPosition="Left" /> </Column> </Group>
On the File menu, click Save<file name>.xml to save changes to the XML file.
To import the new work item type to a single project, see How to: Import a Work Item Type to an Existing Project. To add the work item type to your process template, see Work Item Types.
To verify changes imported to a single project
In Team Explorer, click Refresh to download the latest updates from the server.
These updates include the changes that you just imported. Wait several seconds until the Work Items node is loaded. Nodes that are still loading display the word working.
Create a new work item using the work item type you modified. To do this, right-click the Work Items node, point to Add Work Item, and then select the work item type.
This work item is created from the work item type that you changed and imported.
Click Close to close the new work item. Click No when you are prompted to save the work item.
Security
To perform this procedure you must be a member of the Team Foundation Administrators group or a member of the Project Administrators group for the project. For more information, see Team Foundation Server Permissions.
See Also
Tasks
How to: View a Work Item Type Field
How to: Rename a Work Item Type Field
How to: Delete a Work Item Type Field
Concepts
Reference
FIELD Element (WORKITEMTYPE Element)
FIELDS Element (WORKITEMTYPE Element)