I need to create a dashboard widget for Azure DevOps that shows number of work items of a specified type, that transitioned from one state to another.
It looks like the Updates endpoint is my best bet, but that means that I would have to iterate over all of the updates of workitems for the specified type and then determine if it contains the state transition I'm looking for, e.g. Closed to Open.
https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/updates/list?view=azure-devops-server-rest-5.0
The Analytics extension looked promising, but it looks like I would need to query the Revisions dataset, and that doesn't contain the old and new values.
https://learn.microsoft.com/en-us/azure/devops/report/extend-analytics/wit-analytics?view=azure-devops
The use case is to show the number of bugs that were closed then reopened in the last 90 days. I thought that I would make the work item type and from and to states configurable.
Any ideas or suggestions much appreciated!
Best approach to get count of workitems state transitions?
At this moment, we could not query the History with State changed from one state to another state on Web UI directly.
As workaround, we could add a custom field in our custom process that gets set the value to true when workitems state change from Closed to New:
Then add a Rules to set the value of the custom field to True if the workitems state change from Closed to New:
Finally, we could query the workitems with following conditions:
BTW, if you want to get those workitems which state already changed from Closed to New before use above custom filed and rules, I am afraid you have to use Rest API to query the work items that in specified type:
https://learn.microsoft.com/en-us/rest/api/vsts/wit/wiql/query%20by%20wiql
Then loop the work items list to get all revisions for every work item with Revision - List API:
https://learn.microsoft.com/en-us/rest/api/vsts/wit/revisions/list
There is a article for TFS TFS SDK: Work Item History Visualizer using TFS API, you can check it for some more details.
Hope this helps.
You may do it through PowerBI. Calculate time-in-state for an existing Analytics view
Or as you said iterate over all of the updates of workitems.
Related
I'm using the TFS 2010 query editor. I am trying to write a Tree of Work Items query to show all User Stories and Bugs.
I'd like to be able to include all child Tasks related to the Bugs, but not show child Tasks of User Stories. Is this even possible with TFS? If so, how?
I'm afaraid you cannot specify the condition on Work Item Type of parent work item for linked work items.
Unless you have your own field in work items where you save the parent work item type of course. Then you could use this field for filtration.
I used the Process Editor to create a new State for User Story work items (the state of Proposed). When I create a new story it works fine, the User Story is created and the initial state is Proposed, just like I want it.
However when I open an existing User Story work item (one created before I made the change), it doesn't have the Proposed state as an option, and furthermore it will not accept it if I type Proposed in the State field.
Does this mean that any changes made to a Work Item Template will only apply for new work items going forward?
The proposed state is not in the dropdown, most likely because there is no transition from the current state of the work item to the proposed state.
Could you verify this?
Is there a way to auto increment a number field in a WITT (e.g. Bug). We've got a requirement that we want contiguous Bug ids (note - not its actual id but a separate field).
Can this field be done unique per collection OR unique per project (thus duplicates would occur in the collection).
---edit
I've no idea how to tackle this, but I'm wondering if I could use a globalist, e.g. bug creation triggers the adding (replacement) of a value to the list?
There is no way to do this directly through the WIT platform. You would need to write some sort of custom service to do this for you on the creation of a new bug.
My answer goes into the same direction like aaronbjorks one.
Create a webservice that gets alerted if a new bug is created, then just write down the bug ID in a database with an identity column. On the workitem you can create a custom control, that gets the identity for that bug from the database and displays it somewhere.
A possible workaround would be exporting your items query to Excel and let it update the IDs upon Publish. Make sure once an ID was assigned, tag it as FROZEN.
I'm currently writing a series of "Sanity Check" queries for our MSF Agile based project on TFS 2010.
The search I'm struggling with is the following:
Find all User Stories which:
- Have child tasks (or bugs)
- All child tasks/bugs are in the Closed state
- The parent User Story is not closed
The goal being to find user stories that should/could be closed but are not yet.
There doesn't seem to be a way to get the count of child tasks, if I could do that then I could search for "has child tasks, and no child task is not closed". But perhaps there is another way to get the end result I am after ?
Update: More information
My closest search to this so far is:
Team Project = #Project
And Work Item Type = User Story
And State <> Closed
and linked items that match the query below
State <> Closed
Linking Filter: Only return items that do not have the specified links
This almost gets me what I want, however it returns user stories which have no tasks attached, I do not want those to be included.
First you need to change the type of query to be "work items and Direct Links"
In the first query type the following:
Field ------> Work Item Type
Operator---> =
Value -----> User Story
In the second criteria table which is the child of work items, choose all criteria you need
Edited
See the following image
In the web version of team explorer I've selected few work items (they are pretty similar: same type, assigned to me, are in same state). When I selected them and clicked "Edit Work Items" new window appeared with text:
State () cannot change the state
() To change the state or reason, selected work items must be of the same type and state
What is wrong in my case? Those items are of the same type and state. Why I can't update them?
Thanks.
Any thoughts are welcome.
Hard to say without more information. I should point out that you can't "bypass" a state transition that's required by your work item type. For example, you probably can't move a bug directly from "Active" to "Closed" without first setting its state to "Resolved."