Custom attribute queries and link queries
You can create queries to find work items based on custom attributes and links.
Custom attribute queries
Querying on custom attributes in the query editor is the same as
querying on built-in attributes. However, in contrast to built-in
attributes that every work item has, custom attributes might be missing
from items that were created before the custom attributes were defined.
The possibility of a missing custom attribute must be accounted for
when you create a query that uses the exists operator.
For information about how to synchronize newly added attributes to
existing work items, see the support article How to make new custom attributes available in existing
work items.
You can use the exists operator to query for work items that have a certain custom attribute set. Alternatively, you can use this operator when it is not possible to query the custom attribute value, as is the case for large string custom attributes. An example is creating a query for all items in a specific iteration that have a Build Notes custom HTML attribute.
Link queries
Technically, links to other artifacts are not attributes of a work item; instead, links are separate items that join two artifacts. However, in the query editor, links are treated like attributes. You can select the link attribute to query for its existence, or you can specify a condition on one of its target's attributes. For examples of creating link queries, see Examples of creating queries.
Link query results (Eclipse client only)
When
you create a link query, if you are interested in both the work items
that fulfill the link conditions and the link targets, you can enable
links mode in the Work Items view. On the View menu,
click the down arrow
and select Relationships.
The Relationships view displays the referenced work items in the query
results tree without the need to open a work item first. Only references
to other work items are shown in this view.
Example of query results with linked work items that display in a tree hierarchy:
