Query Work Items task

Azure Pipelines | Azure DevOps Server 2019 | TFS 2018 | TFS 2017

Use this task in a build or release pipeline to ensure the number of matching items returned by a work item query is within the configured thresholds.

Can be used in only an agentless job of a release pipeline.


In Microsoft Team Foundation Server (TFS) 2018 and previous versions, run and release pipelines are called definitions, runs are called builds, service connections are called service endpoints, stages are called environments, and jobs are called phases.



YAML snippet

# Query work items
# Execute a work item query and check the number of items returned
- task: queryWorkItems@0
    #maxThreshold: '0' 
    #minThreshold: '0' 


Parameter Comments
Query Required. Select a work item query within the current project. Can be a built-in or custom query.
Upper threshold Required. Maximum number of matching workitems for the query. Default value = 0
Lower threshold Required. Minimum number of matching workitems for the query. Default value = 0
Control options See Control options

Succeeds if minimum-threshold <= #-matching-workitems <= maximum-threshold

For more information about using this task, see Approvals and gates overview.

Open source

This task is open source on GitHub. Feedback and contributions are welcome.