Query work item history and discussion fields in Azure Boards
TFS 2017 | TFS 2015 | TFS 2013
The history of a work item tells you who opened the item, what changed, and why. This information helps you track how an item changes over time. When you enter information in the history field, provide as much information as possible to help the next work item owner understand what has happened and what they have to do.
Note
There is no Discussion work item field. To query work items with comments entered in the Discussion area, you filter on the History field. The full content of the text entered into the Discussion text box is added to the History field.
Supported operators and macros
Query clauses that specify the History field can use the Contains Words and Does Not Contain Words operators. Search against an exact phrase or to use the wildcard character, *. You can only use the wildcard character at the end of a partial word or phrase.
The History field is automatically indexed for full-text search when full-text search is available. See Full-Text and partial word searches
Query a work item's history
You can use either the web portal or Team Explorer to view the history of a work item or find work items based on the contents of the History field. When you run a search on the contents of the History field, it returns only work items that have changes recorded in that field. That is, it doesn't register changes that were made to text in other fields.
List items based on the contents of the History field
You use the query editor to add the History field to a query clause. Comments entered into the Discussion area are queryable. Change history entries, such as which fields were changed, aren't queryable. To quickly find items based on words entered into the Discussion area, or Description or other rich-text fields, consider using work item search.
You can filter for work items by the date on which they were changed or for a specific time period. If you limit the scope of your query, it can help with performance by only returning those results that fit the date range that you want to include.
Filter for
Include these query clauses
Items whose History field contains the word "reproducible"
History Contains Words reproducible
Items whose History field doesn't contain the word "beta"
History Does Not Contain Words beta
Items that contain the phrase "stack traces" and were closed but reactivated
History Contains Words stack traces
And State Was Ever Closed
And State <> Closed
Items closed within a specified time period
State = Done
And Closed Date > 7/1/2015
And Closed Date <= 7/21/2015
Items I've been associated with
History Contains Words MyName
Or Assigned To Was Ever _ @Me
Tips for using the query editor
- Type the complete word or phrase that is specified in the History field of those work items that you want to find.
- Enter the full text for the word that you want to search. The History field is indexed for full-text search. If you enter only a partial word, the query won't return work items that contain the full word. For example, if the History field contains the phrase reproducible behavior and you search for repro, the work item won't be found. However, if you search for the complete word reproducible, the work item will be found. You can also search for the string with a wild card, such as
repro*
. - The query editor ignores common words or stop words as defined in Configure and Manage Stopwords and Stoplists for Full-Text Search.
- On the query editor toolbar, choose or icon and confirm that your query returns expected results.
- If you don't receive the results you expect, adjust the word or phrase that you entered, and run the query again.
View the history of work items
An entry is made to the History field each time a work item is saved. To view the history of changes, open an existing work item, and then choose the or History tab, or for some work item types, choose the Details tab.
The history details shown depend on the platform, version, and client.
The state change history diagram appears first. To see the entire history of state changes, choose Show all.
Choose an entry in the left pane to view the details of changes made.
Note
With TFS 2017 and later versions, the History field is no longer a rich-text field. To annotate the work item history, add to the Description or Discussion fields.
Fields that support history, auditing, and revision tracking
You can use the following fields to filter queries and create reports. Several of these fields are populated with information as a work item progresses from one state to another. Other fields update when the work item is modified. Some fields don't appear on the work item form, but they're tracked for the WITs listed.
Field name
Description
Work item type
Changed By
The name of the team member who modified the work item most recently.
Reference name=System.ChangedBy, Data type=String
All
Change Date
The date and time when a work item was modified.
Reference name=System.ChangedDate, Data type=DateTime
All
Closed Date 1
The date and time when a work item was closed.
Reference name=Microsoft.VSTS.Common.ClosedDate, Data type=DateTime
All
Created Date
The date and time when a work item was created.
Reference name=System.CreatedDate, Data type=DateTime
All
History
The record of changes that were made to the work item after it was created. Every time that the work item is updated, information is appended to the history, which specifies the date of the change, who made the changes, and which fields were changed.
Note
History field queries return work items whose Discussion comments or Description fields contain words that match the keywords entered. You can't use the History field to query on changes made to other fields.
You can't add formatted text to the history field. Once you've saved the work item, you can't alter the history.
The History
field, along with the Description
, Steps to Repro
and Title
fields are automatically indexed for full-text search as described in Query fields, operators, and macros.
Reference name=System.History, Data type=History
All
Resolved Date 1
The date and time when the work item was moved into a Resolved state.
Reference name=Microsoft.VSTS.Common.ResolvedDate, Data type=DateTime
Bug (Agile, CMMI)
Rev
A number that is assigned to the historical revision of a work item.
Reference name=System.Rev, Data type=Integer
All
State Change Date
The date and time when the value of the State field changed.
Reference name=Microsoft.VSTS.Common.StateChangeDate, Data type=DateTime
All
Tracks other operations performed when modifying a test suite, for example: adding tests to a test suite or changing configurations. This field can be viewed through the History tab or through a separate query. There will be a consolidated history view, including changes performed to work items field and changes resulting from related artifacts such as test points and configurations. Reference name=Microsoft.VSTS.TCM.TestSuiteAudit, Data type=PlainText
Test Suite
A system-managed field (not editable) that increments with changes made to a work item. Reference name=System.Watermark, Data type=Integer
All
Note
For these fields to be defined for a WIT, they must be included in the
WORKFLOW
section of the WIT definition. For example, this syntax is included within theFIELDS
definition when transitioning to a Resolved state:<FIELD refname="Microsoft.VSTS.Common.ResolvedDate"> <SERVERDEFAULT from="clock" /> </FIELD>
Related articles
SDK resources
To programmatically interact with queries, see Query for Bugs, Tasks, and Other Work Items.