Alex
Alex

Reputation: 21

TFS 2010 - query needed to join three levels of WorkItems

I am just configuring some WorkItem Types to manage our releases - I've got quite far but I cannot see how to get a query to list what I need.

I have User Stories that have "Application Deployment" workitem types as children. Each Application Deployment represents an application to deploy. A User Story might require two applications to be changed. This is a parent/child relationship.

Separately to that, I also have "Release" workitem types. Each Release represents a day on which we will deploy our software. A Release will have several User Stories associated with it - I think using the Network topology of LinkType. This is because a User Story might actually be associated with more than one Release (for example, if we release to one territory first, and then to all remaining territories a week later).

What I would like is a query that lists what applications need to be released:-

Release 14/03/2012 Application

Upvotes: 2

Views: 2783

Answers (1)

Edward Thomson
Edward Thomson

Reputation: 78673

If I understand correctly, you're looking to return all the "Application Deployment" work item types associated with a given "Release".

In the query editor, you should be able to select your query type as "Tree of Work Items", and set your query to be Work Item Type = Release, and select linked work items that match the query Work Item Type = Application Deployment.

You can of course add other query filters.

This will give you roughly the following WIQL:

SELECT
    [System.Id], [System.WorkItemType], [System.Title],
    [System.AssignedTo], [System.State]
FROM WorkItemLinks WHERE
    (
        [Source].[System.TeamProject] = @project
        AND [Source].[System.WorkItemType] = 'Release'
        AND [Source].[System.State] <> ''
    )
    AND ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward')
    AND [Target].[System.WorkItemType] = 'Application Deployment'
ORDER BY [System.Id]
mode(Recursive)

Upvotes: 2

Related Questions