TFS Query to get EPICs closed but any of the related Feature or User Story or Task not closed

702 Views Asked by At

I need a TFS Query to get EPICs in closed state but with any of the related Feature or User Story or Task not closed. Even it should work if Feature closed but User story or Task not closed. User story closed but task not closed.

Can it be done with a single TFS Query in TFS 2013?

I am able to Get Features closed with User story not closed (or) User story closed but Task still not closed through TFS query.

Can I do above EPIC (Closed) -> Feature (<> Closed) -> User Story (<>Closed) -> Task (<>Closed) in single TFS query?

3

There are 3 best solutions below

2
On BEST ANSWER

I am able to get the data using below Query.

Used 'Work Items and direct links' type Query.

Top level work items: Work Item Type 'In' Feature,User Story AND Area & Iteration path. AND State = Closed

Filters for linked Work items: Work Item Type 'In' User Story,Task AND State <> Closed

Filter options: Only return items that have matching links Return selected link types: Child

I am able to achieve data for Feature (Closed) -> User Story (<>Closed) -> or Task (<>Closed) & User Story(Closed) but Task (<>Closed) & Feature(Any status).

Will try to use for more levels.

0
On

No, it's not able to do this.

First all of all, you need to use the tree query (by select Tree of work items) to view a multi-tiered, nested list of work items.

To find linked children, you need to select Match top-level work items first. This is the closest query.

enter image description here

However, as you already point out. This query will judge all child work items if it's closed or not. Will return those child work items which not closed. Kind of

EPIC (Closed) -> Feature (<> Closed) -> or User Story (<>Closed) -> or Task (<>Closed)

But what you need is actually:

EPIC (Closed) -> Feature (<> Closed) -> and User Story (<>Closed) -> and Task (<>Closed)

If a child work item of the whole tree is closed then not return the tree.

This is not available in single TFS query.

2
On

There's also no build-in way to do that. The state of work items are totally independent of all other work items, including linked work items.

Some workaround to manage it at the moment that:

  1. From Server-side: You can add a plugin to tfs, that changes workitems. A good example would be TFSAggregator. The problem with this solution is, that it only changes a workitem after it has been saved. So user will still be able to close the child, but the server will re-open it. In other words, you cannot prevent the close, but you can re-open immediately after detecting the non-allowed action.

  2. Use client API to monitor with Parent-Child relationship. For example, EPIC Feature-> and User Story->Tasks. If the child not closed, then do not close parent. A layer upon layer in tree. Same code may be helpful for your reference: Close a Work Item only if Child Work items are closed