Customize your Work Item Type Definitions: Take advantage of Link Types

TFS 2010 allows you to create many different types of links between work items.  These are the available link types (out of the box):

  • Affects/Affected by
  • Tested By/Tests
  • Test Case/Shared Steps
  • Successor/Predecessor
  • Child/Parent
  • Related

This is a big change from the previous version as back then you could only create “related” link between work items. 

When you create a link between work items, you get a different graphical view depending of which link type you pick:

Affects/Tested By/Test Case/Successor
image

Parent/Child
image

Related
image

You can then choose to show related work items with a specific link type as part of your Work Item Type Definition.  You can see this in action if you look at a User Story in the MSF for Agile template:
image
The Implementation tab shows you only Parent/Child relationships, the Test Cases tab shows you “Tested By” relationships, and the “All Links” tab shows you every work item, changeset, and hyperlink related to your work item. 

If you want to implement something similar on your own work item type, this is what you need to do:

  • From the WorkItem editor (Power Tools), add a new control of type “LinksControl”
  • On the new control properties, select the Control Settings: “LinksControlOptionsType”
  • By default, you are going to see this:
    <LinksControlOptionsType>
      <LinkColumns>
        <LinkColumn RefName="System.Id" />
        <LinkColumn RefName="System.Title" />
        <LinkColumn RefName="System.AssignedTo" />
        <LinkColumn RefName="System.State" />
        <LinkColumn LinkAttribute="System.Links.Comment" />
      LinkColumns>
      <WorkItemLinkFilters FilterType="includeAll" />
      <ExternalLinkFilters FilterType="includeAll" />
      <WorkItemTypeFilters FilterType="includeAll" />
    LinksControlOptionsType>
  • The LinkColumns section allows you to specify which values of the related workitems you will show on your list. 
    • The WorkItemLinkFilters is used to control what types of links you will display.  This also controls the links types that show up on your “Link Type” drop-down when you are going to link to another work item from this control.  If you want to see a list of the link types that your TFS system has available, you can run this command:

      witadmin listlinktypes /collection:http://yourserver:8080/tfs/defaultcollection
    • You can read about the different link type topologies here: http://msdn.microsoft.com/en-us/library/dd293527.aspx
  • The ExternalLinkFilters section lets you specify if you want to see work items, changesets, external links, etc.
  • The WorkItemTypeFilters section lets you filter by just specific work item types.

In my case, I wanted to all my parent and children tasks, so I used this:

<LinksControlOptionsType>
  <LinkColumns>
    <LinkColumn RefName="System.ID" />
    <LinkColumn RefName="System.WorkItemType" />
    <LinkColumn RefName="System.Title" />
    <LinkColumn RefName="System.AssignedTo" />
    <LinkColumn RefName="System.State" />
    <LinkColumn LinkAttribute="System.Links.Comment" />
  LinkColumns>
  <WorkItemLinkFilters FilterType="include">
    <Filter LinkType="System.LinkTypes.Hierarchy" />
  WorkItemLinkFilters>
  <ExternalLinkFilters FilterType="excludeAll" />
  <WorkItemTypeFilters FilterType="include">
    <Filter WorkItemType="Task" />
  WorkItemTypeFilters>
LinksControlOptionsType>

And that translates to this:

image

You can also further filter which relationships are shown (for example, parent vs child).  You can read about it here: http://msdn.microsoft.com/en-us/library/dd638522.aspx

Scroll to Top