Mahmoud Moravej
Mahmoud Moravej

Reputation: 9034

How do I query in TFS to get work items with specified conditions for ALL OF its childs

In TFS query builder, I need a query to get all PBIs that ALL of its child tasks are in done state. for example :

PBI : User Story 1
    - Task 1 (Done)
    - Task 2 (Done)
    - Task 3 (Done)

PBI : User Story 2
    - Task 1 (Done)
    - Task 2 (Done)
    - Task 3 (In Progress)

In above example, the desired query should only returns User Story 1

Upvotes: 2

Views: 5761

Answers (2)

You should create a "Work Item and Direct Links" query.

In the top query select:

"Work Item Type = Product Backlog Items" & "State In Committed, Done"

In the bottom query select:

"Work Item Type = Task" & "State <> Done"

In the radio buttons on the left select:

"only top level items that do not have the link."

enter image description here

Should suit but there are two assumptions:

  • All PBI's that have been committed by the team have at least one task
  • PBI's that are in New or Approved are not being worked on

Upvotes: 5

liorlevi1974
liorlevi1974

Reputation: 77

Type == "Product Backlog Item"

Total number of Child Tasks > 0

Number of Child Tasks WHERE (task.State == "Done") == Total number of Child Tasks

Upvotes: -2

Related Questions