Is there a way I can reorder work items from a query results as I would normally do with backlog work items?
I'm using the order of work items in the backlog to set the order of issues to address, I would like to use queries to view work items by certain criteria (cross-project) so the backlog board is not a good choice for me.
thank
The description is little confusing, but if you just want to order your query result(according to the title of this thread) by specific condition, the wiql would be very helpful.
Add the Wiql Editor extension to your organization, then create a query with the other conditions you need, click the "Edit query wiql" and update the query wiql.
For information about wiql syntax, please check Syntax for the Work Item Query Language (WIQL), the order by would be the one you are looking for.
Related
I have a query listing all features and their child/related work-items.
Is there a way not to display the features (parents) itself? Just a flat list of all work-items having a link with a feature in this project.
I am afraid you cannot use the flat list of work items to query the work items with links.
You can have a try using a Work items and direct links type of query to show the children work items of the Features on the top level. See below:
If you want to add a query result account widget on dashboards, you can check out the Query Tile PRO tool.
I'm using the basic work item process in Azure DevOps.
If I look at my backlog without any filters, then it shows me a hierarchy, with epics as the top-level items, then issues and then work items.
If I filter this to only show items that are to do or doing, it shows them as a flat list, not a hierarchy.
Is there any way to see the items as a hierarchy, but filter out done items?
Update following Shayki Abramczyk's comment
The options button doesn't include an option to show parents...
Go to the Work Item Query tab and create a work item query. Configure it to Tree view and let it follow the parent/child relation.
You can filter on the top level (top part of the query editor) and the lower levels (bottom part of the query editor). Use the State in filter to select multiple states. You can't multi-select them in the UI, so typing is required:
PS: The , is the list separator in most languages, but sometimes you need to use ;.
If you want to see parents when ANY child leaf is still open, set the Filter: Match top-level items first to Filter: Match child-level items first.
To specify the order, add the Backlog Priority field to the query and use the table header to sort by it:
Or use the Sorting option in the "Choose Columns" fly-out:
Note: The exact field name differs per Process template. Backlog Priority is for the Scrum Template, Stackrank for CMMI and Agile and Basic:
An easy way to get started is to take the board view closest to what you want and save it as a work item query.
I want to make a WIQL query to count the workitems from the type 'Bug', grouped by the title and the software version fields. But, there is no group by function in WIQL. Does anyone have an alternative to make this work in WIQL?
SELECT
[System.Title],
[System.State],
count(*)
FROM workitems
WHERE
[System.WorkItemType] = 'Bug'
AND [System.State] <> ''
GROUP BY [System.Title], [Custom.ToolSoftwareVersion]
The queries are used to create dashboards and overviews, ect.
Does anyone have an alternative to make this work in WIQL?
Based on my experience, the short answer is no.
As you mentioned, GROUP BY and COUNT are not supported currently. More information on the WIQL syntax is available in this document.
Azure DevOps also supports using the WIQL API to query the result. My workaround is that you could query the result as a list, then you could GROUP BY and COUNT the results with our customized code.
POST https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/wiql?api-version=5.0-preview.2
By the way, you also could give your feedback to the Azure DevOps team.
An alternative approach is to use a "Chart for Work Items" widget that provides a Pivot Table view. You can choose aggregation types such as COUNT, SUM.
This operates similarly to Pivot Tables in Excel with numbers in the output rather than a chart.
Choose Chart Type:
Choose row and column axes
The result is presented as a table with "group by" / count style
I'm creating a Visual Studio Team Services extension that in it's current iteration is supposed to display child tasks for development, testing, etc. that were added to a work item. I build a WIQL query to get these tasks and some data about them.
In VSTS (and TFS), tasks have an Activity field, which I want, to differentiate between the different types of tasks (development, testing, etc.). However, I'm finding with the below WIQL query I create, I get the following error: TF51005: The query references a field that does not exist. The error is caused by «[System.Activity]». Is there a way I can get access to the Activity field for those tasks? Or is it just not supported currently?
SELECT [System.Id], [System.WorkItemType], [System.Title],
[System.Activity], [System.State]
FROM WorkItemLinks
WHERE (Source.[System.TeamProject] = 'someProjectID'
AND Source.[System.Id] = someWorkItemID
AND Source.[System.State] <> 'Removed')
AND ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward')
AND (Target.[System.WorkItemType] = 'Task')
MODE(Recursive)
Working through this I discovered https://marketplace.visualstudio.com/items?itemName=ottostreifel.wiql-editor, which has helped make it alot easier debugging my WIQL query. I highly recommend it to anyone who is new to working with WIQL.
You can create a query with necessary fields in web access, then get detail wiql by using Get a query or folder REST API (add $expand=wiql parameter).
I looked some more and discovered my answer, apparently Microsoft.VSTS.Common.Activity is the field you want to reference to get the activity for the task. I found it here: https://www.visualstudio.com/en-us/docs/work/track/query-numeric. Looks like there's some more information there about some data you can grab, like Microsoft.VSTS.Scheduling.StoryPoints. However it's definitely not a complete list, and I wasn't able to find one. Feel free to comment on this if you know of a complete list of references to use to grab anything you want about a work item!
Is there a way to query work items where a user was mentioned? I am able to receive 'hard-coded' results by querying for
"History"-"Contains word"-"\#Username",
but I want a generic version, which works for all users. (Opposed to writing one query for every user)
Use this predicate:
Field: "ID"
Operator: "In"
Value: "#RecentMentions"
This automatically filters for work items, where current user has been mentioned.
I found it in predefined filter "Mentioned" in "Work Items" section. If you click on "Open in Queries" button, you will get a query with above filter. (This section can even remove the need for that query...)
Note: at present time, works only in VSTS.
https://{org}.visualstudio.com/{project}/_workitems/mentioned/
This would achieve the same result.
There is no way to achieve this by work item query directly just as starain mentioned. You can create a custom hub or custom widget by using VSTS Extension to show these information in web portal.
You can’t achieve that through work item query directly, you could build a app to retrieve data through REST API (https://www.visualstudio.com/en-us/docs/integrate/api/wit/wiql), change query text according different conditions (e.g. users)
Your query should be something like this
Select Id,Title From WorkItems Where ID IN (#RecentMentions) order by [System.ChangedDate] desc
here is the reference for rest of the macro's available in ADO rest API.
https://learn.microsoft.com/en-us/azure/devops/boards/queries/query-operators-variables?view=azure-devops