Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using WIQL, how do you query VSTS Work Items on System.Tags

This is not an on-premise install, just VSTS. I'm new to working with the VSTS REST API and WIQL. I am trying to run a query that filters my work items on System.Tags = 'User Generated'. When I retrieve my Work Item, I can see in the JSON:

System.Tags : "User Generated"

I am using the following guide to build my query and have everything working except when I try to filter on Tags. I have tried [System.Tags] Contains ('User Generated'), etc. Nothing seems to work. Any ideas?

VSTS WIQL Reference

like image 316
Papa Burgundy Avatar asked Apr 14 '15 14:04

Papa Burgundy


People also ask

How do I get WIQL from a query?

You can use Chrome's "Developer Tools" (under "More Tools") click the Network tab and run the TFS query. You'll see the query item in the list of items. Click on the query item and you'll see the WIQL code in the view pane. Brilliant!

What is WIQL query?

A WIQL query consists of a SELECT statement (similar to that of the SQL language) that lists the fields to be returned as columns in the result set. (Learn more.) In TestArchitect, you might use a WIQL query to specify the location(s), in terms of test points, to which TA results are to be uploaded to TFS.

How do I get azure DevOps query ID?

You can get the query ID in the URL: Select a query. The URL format will be like: https://[xxx].visualstudio.com/[project]/_queries?id=effb4d62-1b9b-42e9-af7c-dbef725fca4a&_a=query . The id is the value of id parameter.


1 Answers

Ok so right after I give up and post, I figured it out. I was using Contains incorrectly. I had the filter in parenthesis. Both of the following examples work now.

Select [System.Id], [System.Title], [System.State], [System.Tags]
From WorkItems
Where [State] <> 'Closed'
 AND [State] <> 'Removed'
 AND [Tags] Contains 'User Generated'
 AND [System.WorkItemType] = 'User Story'
 order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc

Or this:

Select [System.Id], [System.Title], [System.State]
From WorkItems
Where [State] <> 'Closed'
 AND [State] <> 'Removed'
 AND [System.Tags] Contains 'User Generated'
 AND [System.WorkItemType] = 'User Story'
 order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc
like image 176
Papa Burgundy Avatar answered Nov 23 '22 01:11

Papa Burgundy