azure-devopsazure-boards

Query all nested work items for items with specific link type


How do I build a tree of work items based on Parent/Child/sub child.. relations, and then get a list of items linked to both parent and children that has a specific work item type?

My Parent/Child structure looks like this:

ID   Work Item Type   Name
188  Feature          Feature with test case
189  User Story         Story with test case
190  Task                 Task with test case

I've tried with work items and direct links based on this recommendation like this:

Type of query: Work items and direct links
Filters for top level work items

    Field               Operator            Value
    Work Item Type      =                   [Any]
And Area Path           Under               POC Works

Filters for linked work items

    Field               Operator            Value
    Work Item Type      In Group            Microsoft.TestCaseCategory

Filter options              Type of links
Return all top level items  ø Return links of any type
                            o Return selected link types

(Would love to upload pictures of the query, but are apparently blocked from doing so)

Adding any sort of ID restriction to the top level query for items related to the tree of Feature #188, stops the query from traversing all children. I need this limited scope. How can this be done?


Solution

  • How do I build a tree of work items based on Parent/Child/sub child.. relations, and then get a list of items linked to both parent and children that has a specific work item type?

    Based on your requirement, you need to get the Parent/Child/Sub child work item tree and get a list of items linked to both parent and children that has a specific work item type

    I'm afraid we cannot use single query to directly meet these requirements. The following are the restrictions for different query types:

    When you use the Work items and direct links type query, it can list all work items with directly links. It cannot display the linked work items that the sub child is connected to.

    For example:

    enter image description here

    When you use the Tree of Work Items type query, it can list Parent/Child/sub child work item tree. But it only supports showing the Parent/Child link. It will not get a list of items linked to both parent and children that has a specific work item type.

    For a workaround, you can use the Tree of Work Items type query to get the Parent/Child/sub child work item tree.

    For example:

    enter image description here

    Then you can record the work item ids and use another Work items and direct links type query to query the linked work items of the work items.

    For example:

    enter image description here

    I can fully understand your requirement. You can submit a suggest ticket in the site: Developer Community to report this feature