Monday 7 July 2014

Setup web browser (Google Chrome) search engine for TFS2013

Introduction 

On TFS 2013 Web Interface, it is possible to search any item with new custom queries. However, sometimes it takes too long time if we just need to search items with a short keyword. e.g. "Crash", "Password", ... It's really ineffective to define a new custom query every time for this purpose, indeed. 

Luckily, TFS supports WIQL syntax directly on URL so we can easily setup browser search engine by pre-setting WIQL syntax with keyword replacements. I'm illustrating how-to for Google Chrome, but the same idea can be used in other browsers. 

Keyword Search
  1. ​​Go to settings
  2. Click "Manage search engines" on "Search" tab
  3. Put a new search engine with the following:
    • ​name: TFS title and contents 
    • keyword: tfs 
    • url: http://<TFS web interface base URL>/_workitems#_a=query&wiql=SELECT [System.Title], [System.State], [System.AssignedTo], [Microsoft.VSTS.Scheduling.RemainingWork] FROM WorkItemLinks WHERE (Source.[System.Title] contains '%s' or Source.[System.Description] contains words '%s' or Source.[System.History] contains words '%s') and ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward') ORDER BY [Microsoft.VSTS.Common.BacklogPriority], [System.Id] mode(Recursive)
      • The base URL is usually the home address of your project. e.g. http://my-tfs-01/tfs/org/TheProject
  4. ​Click "done" 
This is an example result with search keyword 'Evolution':



Item ID search 

Similarly, it is also possible to setup another search engine with TFS ID number. For this case, the configuration will be like this:
  • ​​name: TFS ID
  • keyword: tfsid
  • url: http://<base URL>/_workitems#_a=query&wiql=SELECT [System.Title], [System.State], [System.AssignedTo], [Microsoft.VSTS.Scheduling.RemainingWork] FROM WorkItemLinks WHERE (Source.[System.Id] = %s) and ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward') ORDER BY [Microsoft.VSTS.Common.BacklogPriority], [System.Id] mode(Recursive)​

No comments: