Azure DevOps 查询工作项(如果有 parent 正在进行中)

Azure DevOps query for work items if any parent is in progress

我正在努力识别我们所有没有故事点估计的产品积压项目。但是,我们现在有太多需要估算的 PBI(产品积压项目)。这简直是​​一团糟。我需要一个查询来帮助缩小工作范围。我知道如何创建一个 Azure DevOps 查询,这样我 return 所有 new 的产品积压项目都没有 effort[= 的值25=].

wiql 看起来像这样

SELECT
    [System.Id],
    [System.WorkItemType],
    [System.Title],
    [System.AssignedTo],
    [System.State],
    [System.Tags],
    [Microsoft.VSTS.Scheduling.Effort]
FROM workitems
WHERE
    [System.TeamProject] = @project
    AND [System.WorkItemType] = 'Product Backlog Item'
    AND [System.State] = 'New'
    AND [Microsoft.VSTS.Scheduling.Effort] = ''

但是,我需要它再添加一个步骤来过滤掉处于活动状态的 parent 或 grandparent 的项目。

问题:

What is a query that I could use that work gives me only the “PBI”s I don't have an effort in the state new where one or more of their parents(recursive) has a state of in progress ?

首先,工作项不存在所谓的“Grandparents”关系。

对于像PBI p这样的特定工作项,它只能像Feature F1一样有“Parent”,对于Feature F1,如果它像另一个Feature F2一样有parent你可以在逻辑上称它为PBI p的“Grandparent”,但这个Feature F2实际上与PBI p无关。请检查 Work link types 以获得更好的理解。

另外,如果想在Azure DevOps中查询“Parent”等关系,可以将“Type of query”改为“Work items and direct links”。您可以查看 Use direct links to view dependencies 了解更多信息。

请参考下面的 wiql,您将看到如何查询 PBIseffort 为 nullparent 状态为“In Progress”:

SELECT
[System.Id],
[System.WorkItemType],
[System.Title],
[System.AssignedTo],
[System.State],
[System.Tags]
FROM workitemLinks
WHERE
    (
        [Source].[System.TeamProject] = @project
        AND [Source].[System.WorkItemType] = 'Product Backlog Item'
        AND [Source].[System.State] = 'New'
        AND [Source].[Microsoft.VSTS.Scheduling.Effort] = ''
    )
    AND (
        [System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Reverse'
    )
    AND (
        [Target].[System.TeamProject] = @project
        AND [Target].[System.WorkItemType] <> ''
        AND [Target].[System.State] = 'In Progress'
    )
ORDER BY [System.Id]
MODE (MustContain)

下面是对应的查询编辑器:

您可以使用树工作项查询类型(在我的示例中用于用户故事):

SELECT 
    [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State], [System.Tags] 
FROM 
    WorkItemLinks 
WHERE 
    ([Source].[System.TeamProject] = '<Your_project>'  AND ( [Source].[System.WorkItemType] = 'Feature'  OR  [Source].[System.WorkItemType] = 'Epic' ) AND  [Source].[System.State] <> 'New')
     And ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward') 
     And ([Target].[System.WorkItemType] = 'User story'  AND  [Target].[System.State] <> 'New'  AND  [Target].[Microsoft.VSTS.Scheduling.Effort] = '') 
 ORDER BY [System.Id] 
 mode(Recursive,ReturnMatchingChildren)

查询编辑器: