Customize Existing workitem in TFS 2010

When Business users work with any change management tool, most of the time they ask for customization’s. Whatever is the change by adding new value or adding new filed or change the workflow if exist.
In this post i will show you how to edit the TASK workitem and add new filed.To start you need to install TFPT or you can use tfs command line tool.

First Option using command tool yon need to export the TASK workitem, use witadmin as below:C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>witadmin exportwitd /collection:http://tfs:8080/tfs/CollectionName /p:TFSPROJECTNAME /n:TASK /f:c:\temp\TASK.xml /e:utf-8

  • Open TASK.xml file in VS [Crtl + o] and choose open with XML editor as below
  • In the XML you have three main parts ( FIELDS, WORKFLOW and FROM )
  • In this post we will add new Group. Inside this group will add a new filed.
  • In the fields element add below code
    <FIELD name="Configuration" refname="Custom.Configuration" type="String" reportable="detail" />
  • To use this field in TFS relational warehouse make sure you add value ‘detail’ in reportable field.
  • To add this new field in Task workitem form UI. Select FORM element and choose where you want to add it, as example you can add it after ‘status’ group and before the ‘TabGroup’ group.
  • Add below code to create new area called ‘Configurations’ that contains one column with one field inside.
            <Group Label="Configurations">
              <Column PercentWidth="100">
                <Control FieldName="Custom.Configuration" Type="FieldControl" Label="Test Control:" LabelPosition="Left" />
  • Note that he FieldName must have a dot ‘.’ in the name, you could use the default namespace of your team exactly like Microsoft namespace.
  •  After finish add the code, save the xml file.
  • Using the command below import the TASK workitem, you can validate before import by using /v attribute but it will not imported. if the the workitem is valid then re execute the command without /v.
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>witadmin importwitd /collection:http://tfs:8080/tfs/TFSPROJECTNAME /p:Testing /f:c:\temp\task.xml /e:u tf-8 /v

Second option is to use using TFS power tools from visual studio.

  • Open VS 2010 and refer to image below
  • Open TAKS.xml file in VS 2010. It will generate 2 files in same xml file directory (wit file and wit.diagram file).
  • select Fields tab and click new, add information as image below
  • select Layout tab, right click on Layout root and select new group
  • Set label value to  ‘Configurations’, right click on Column and select new Control.
  • Add these properties to the new control
    • Field Name : ‘Custom.Configuration’
    • Label:Test Control.
  • Right click on group and select Move up to change the location the select save. In case any error in the Workitem it will give you an error message.
  • Click Preview Form button to check how is the TASK will be when you import it.
  • Using the same way you export the WI, you can import it again, but you need only to import the XML file not other wit files.

This is simple example to change the workitem, there is many more advance topics i will post it in the future.

Enjoy 🙂

2 thoughts on “Customize Existing workitem in TFS 2010

    • Thanks for you comment, yes I totally agree with you when the user dose not have good experience with XML.As I mention in the article there are some user not familiar with technical data such as XML to manage Work items. But if you have a complex conditions and requirement I found it much easier to use XML instead of GUI to manage WI.
      Finally you will reach the same goal weather you are using XML of GUI, but it depends to the user and how much is faster and easier for him to manage the work item.

Leave a Reply

Your email address will not be published. Required fields are marked *