Query by field value comparisons
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
You can create queries based on how one field's value compares to another using the comparison field operators. This query is useful to filter work items based on:
- Is the person who created the work item the same as or different than the person assigned to it? Or, who closed it
- Which Tasks were closed before or after their Target Date.
Prerequisites
- Access levels:
- To view and run shared queries, be a project member.
- To add and save a shared query, have at least Basic access.
- Permissions: Have your Contribute permission set to Allow for the folder that you want to add a query to. By default, the Contributors group doesn't have this permission.
Note
Users with Stakeholder access for a public project have full access to query features just like users with Basic access. For more information, see Stakeholder access quick reference.
- Access levels:
- To view and run shared queries, be a project member.
- To add and save a shared query, have at least Basic access.
- Permissions: Have your Contribute permission set to Allow for the folder you want to add the query to. By default, the Contributors group doesn't have this permission.
Supported data types
You can use the comparison field operators—=[Field], <>[Field], >[Field], <[Field], >=[Field], <=[Field]
—with the following field data types. The data type you select for the Field and the Value must match.
- Boolean (supports
=[Field], <>[Field]
- Date/Time
- Double, Integer
- GUID
- Identity
- String (excluding Tags)
Note
Some combinations of data type and comparison field operator might not make sense to use, such as Title >=[Field]
or Assigned To <=[Field]
.
Sample filters
Filter for
Include these query clauses
Work items closed by someone other than the person who created the work item
Created By <>[Field] Closed By State = Closed
Tasks whose Original Estimate is less than Completed Work
Original Estimate <=[Field] Completed Work
Closed tasks completed before their target date
Target Date <=[Field] Closed Date State = Closed
Fields that support field comparison
The following table provides an index to those fields that support field comparison queries.
Note
Not all fields listed are supported for all projects or work item types. However, you can customize a process or work item type by adding custom fields which you can use for the purposes of queries and field comparisons. For more information, see Add a custom field to a work item type (Inheritance process) or Add or modify a field (Online XML process).
A
- Acceptance Criteria (Scrum)
- Accepted By
- Accepted Date
- Activated By
- Activated Date
- Activity
- Actual Attendee 1-8 (CMMI)
- Analysis (CMMI)
- Application Launch Instructions
- Application Start Information
- Application Type
- Iteration Id (System)
- Assigned To
- Associated Context
- Associated Context Code
- Associated Context Owner
- Associated Context Type
- Attached File Count
- Automated Test Id (TCM)
- Automated Test Name (TCM)
- Automated Test Storage (TCM)
- Automated Test Type (TCM)
- AutomatedTestId (TCM)
- AutomatedTestName (TCM)
- Automation Status (TCM)
B
C
- Called By (CMMI)
- Called Date (CMMI)
- Changed By (System)
- Changed Date (System)
- Closed By (System)
- Closed Date (System)
- Closed Status
- Closed Status Code
- Closing Comment
- Comment Count
- Comments (CMMI)
- Committed (CMMI)
- Completed Work
- Contingency Plan (CMMI)
- Corrective Action Actual Resolution (CMMI)
- Corrective Action Plan (CMMI)
- Created By (System)
- Created Date (System)
D-E-F
- Discipline (CMMI)
- Due Date
- Effort
- Escalate (CMMI)
- External Link Count
- Finish Date
- Found In Build (TCM)
- Found In Environment (CMMI)
H
- How Found (CMMI)
- Hyperlink Count
I
- ID (System)
- Impact Assessment (CMMI)
- Impact on Architecture (CMMI)
- Impact on Development (CMMI)
- Impact on Technical Publications (CMMI)
- Impact on Test (CMMI)
- Impact on User Experience (CMMI)
- Integrated in Build (TCM)
- Issue (TCM)
- Iteration Id (System)
J-L-M-N
- Justification (CMMI)
- Link Comment (System)
- Link Description (System)
- Local Data Source (TCM)
- Meeting Type (CMMI)
- Minutes (CMMI)
- Mitigation Plan (CMMI)
- Mitigation Triggers (CMMI)
- Node Name (System)
O-P-Q
- Optional Attendee 1-8 (CMMI)
- Original Estimate
- Parameters (TCM)
- Priority
- Probability (CMMI)
- Proposed Fix (CMMI)
- Purpose (CMMI)
- Query Text (TCM)
R
- Rating
- Reason (System)
- Related Link Count (System)
- Remaining Work
- Remote Link Count (System)
- Repro Steps
- Required Attendee 1-8 (CMMI)
- Requirement Type (CMMI)
- Requires Review (CMMI)
- Requires Test (CMMI)
- Resolution (Scrum)
- Resolved By
- Resolved Date
- Resolved Reason
- Reviewed By
- Reviewed Date
- Rev (System)
- Risk (Agile)
- Root Cause (CMMI)
S
- Severity
- Size (CMMI)
- Stack Rank
- Start Date
- State (System)
- State Change Date
- State Code
- Steps (TCM)
- Steps to Reproduce (TCM)
- Story Points (Agile)
- Subject Matter Expert (CMMI)
- Symptom (CMMI)
- System Info (TCM)
T
- Target Date
- Target Resolve Date (CMMI)
- Task Type (CMMI)
- Team Project (System)
- Test Suite Audit (TCM)
- Test Suite Type (TCM)
- Test Suite Type ID (TCM)
- Time Criticality
- Title (System)
- Triage (CMMI)
U-V-W
- User Acceptance Test (CMMI)
- Value Area
- Watermark (System)
- Work Item Type (System)
Related articles
- Query index quick reference
- Query by title, ID, or description
- Query by assignment or workflow changes
- Query by date or current iteration
- Query a numeric field
- Query by picklist value
REST API
To programmatically interact with queries, see one of these REST API resources: