Is there a TFS query macro for the current iteration? - tfs

Is there a way in TFS in VS2010 to specify that a particular iteration is the current one, and then return that for use in queries similar to the way #Project works? If not is there a way to do sub-queries in TFS work item queries?

Looks like Microsoft listened. #CurrentIteration is being added as a token.
That’s great, of course. When looking to write a query against the current sprint, however, you are in danger of losing sight of unclosed work items in previous sprints. When you reach for #CurrentIteration, you probably just mean “all unfinished work that has been committed to a sprint.” If you filter to a single sprint, you’ll miss any stragglers you failed to close or move forward from previous sprints.
Consider using the following pattern, where “ScrumOfScrums\Release 1.0.0.0″ is your backlog path, and all of your sprint paths are children to that:
Filter for work items under your backlog iteration node, but not equal to the backlog iteration node. That will give you all items committed to a sprint.
This will also catch any items that weren’t closed in your previous sprints. Since the goal is to close every item in a sprint before moving to the next one, this query pattern will generally be better than using #CurrentIteration, unless you're looking to find the closed items in the current iteration.
P.S. While this is an old question, it was my top hit when I searched for info on querying the current iteration in TFS.

I'm afraid that there is not such a macro. I personally just have a few "X in current iteration" team queries and then edit those queries to point to the new iteration path at the start of each iteration.

I am going to try using a standard name for the current iteration such as 'Current'. The queries for this iteration would all reference this name. Once the iteration is completed, I will rename it using a naming convention that includes the date for example and the next iteration would then be created with the name 'Current' (or renamed to this if it already exists). The queries would then return results from the new iteration.
- 2010-49
- Current
- 2010-51
I am not sure whether renaming iterations this way will cause any conflicts or confuse the data warehouse for example but this would save on having to create or modify a heap of queries at the start of each iteration.
I would be very interested to hear feedback on this approach!

Query for Sprint in a date interval as shown here:
Team Project = #Project
And Work Item Type = Sprint
And Start Date <= #Today
And Finish Date >= #Today

I have found that Telerik's free Work Item Manager provides an elegant solution to this problem.
Just define your queries as you usually would but leave out any filters relating to iterations (note that this also applies to areas). There is a treeview pane named 'Area/Iteration Filters' that will add extra, recursive filtering based on the iteration (or area) that you select there.
Note that if the pane is not visible then you can enable it via the View menu.

Related

How to query for items that were moved from current iteration to a different iteration?

I am trying to query items(Features, User-Stories, Tasks) that were moved from current iteration to a different iteration (like next iteration), for our team to see which items we didn't accomplished in the current iteration.
Is there a way to do this in TFS?
My TFS Version is 2017 Update 3 RTM
You can track the progress of requirements, bugs, and other work to be completed in the current sprint using the #CurrentIteration macro.
Any item assigned to a sprint which corresponds to the current iteration path for the team will be found. For example, if a team is on Sprint 5, then the query will return items assigned to Sprint 5. Later, when the team is working in Sprint 6, the same query will return items assigned to Sprint 6.
Note
For the #CurrentIteration macro to work, the team must have selected
an Iteration Path whose date range encompasses the current date. For
details, see Define iteration paths (aka sprints) and configure team
iterations. Also, queries that contain this macro are only valid
when run from the web portal.
See also Client restrictions on the use of the #CurrentIteration
macros later in this article.
After exclude those current iteration items, you should be easy to determine those items you need and then you can check the history of these work items which the previous iteration path they are.
One tip is to have a habit of tagging work items with sprint name eg. "P27" from which they were moved to an other sprint. Then it is easy to query. Even though this requires some manual routine tagging ...

How to query for work items for current team in TFS?

I am getting started with TFS 2015 and I need to know how to make a query that returns all of the work items for the current iteration for the current team. I have Iteration Path Under #CurrentIteration and Work Item Type = User Story, but I can find a macro similar to #CurrentIteration that would get the current team or team area. How do I filter out the stories for all other teams?
It's not able to do this through a query. You could check the Query macros or variables, use the macros described in the following table to filter your queries based on specific fields. There is not any team area related macro.
Besides, actually as far as I know work items can only be assigned to specific people not groups. However, for a workaround. By assigning a work item to a specific area path you basically assign it to a team. If you use the area path for something else today, you can also use another string field in the work item that specifies the team.
(https://www.visualstudio.com/docs/work/scale/portfolio-management)
So you could use Area Path to do the filter.
This won't directly solve your problem but you can use 'Assigned to' 'In Group' and then use a user group e.g. '[Home]\Team NI'. This will return tickets assigned to the group or group members but assumes the tickets are assigned appropriately (rather than being unassigned). YMMV but I've found it useful at times to get around this limitation. TFS Azure 2019 now also includes #TeamAreas - which is helpful unless you have multiple teams using the same areas.

TFS2012 User Storys Tasks with different iteration paths

In my Company we are using Team Foundation Server 2012 and Agile as Project Template. We are still learning how the Board and the Backlog show Tasks within User Stories and I realized that "Orphan" Tasks are not shown in these cases...
I made an query to solve the problem about the "Orphan" tasks but I realized that the same issue is happening when a User Story and a Task have, for some reason (maybe someone assign it to a User Story after creating it), a different iteration path... the tasks are not shown in the Backlog or Board.
Is there an automatic way to make tasks having the same iteration path as their parents? How can I make a query to show tasks whose User Stories have a different iteration path as them?
Thanks a lot in advance!
Well. After more researching I have realized about two thing:
- It is not needed to do this in order to show the Tasks in the Board/Backlog because, if the User Story contains tasks that are defined in different iterations, the User Story will be shown in the different iterations, repeated, but only with the tasks belonging to the iteration.
- If someone still wants to create the query, maybe to reunite User Stories, the solution is creating a new Query of the type Work Items and Direct Links and change the following parameters:
* In Filters for top level work item Add a new clause And Iteration Path = IterationA
* In Filters for linked work items Add a new clause And Iteration Path <> IterationA
* In Filter options Types of links select Return selected link types and check Child and Parent.
Unfortunately there is no way, so far I know, to do it automatically for all iterations so you have to do a Query of this type for all iterations.

Specify TFS backglog tree items

Is there any option to configure TFS backlog tree items I'v marked bellow?
EDIT:
I would like to create target structure that looks like:
Current
Future
Experimental
Other
It sounds like you essentially want to add extra metadata to sprints. Unfortunately this is not currently possible (the only metadata supported today is Name, Start Date, End Date).
What some people have done in the past (prior to the Agile Planning tooling), is introduce a Work Item Type called Sprint, then they can define custom fields against it and surface the data in WI Queries.
I suppose you could define a new WI Type and try to associate it with Iterations, but I wouldn't recommend it.
There is no way you can configure the tree on the left panel but since you are using TFS 2013 (also available in 2012) you can use Tags to mark the backlog items that are Experimental or Other.
Add tags to work items to categorize and filter lists: http://msdn.microsoft.com/en-us/library/dn132606(v=vs.120).aspx
Other option is to add a custom field to work items which is not recommended as its painful when you want to upgrade later on.
Modify or add a custom work item type: http://msdn.microsoft.com/en-us/library/hh409273.aspx

Keep Task iteration synchronsied with User Story iteration

When I move a user story from one iteration to another in TFS 2010, I then have to update the iteration in each child task manually. Otherwise it retains the previous iteration value and the various reports and filters don't produce the intended result.
Can anyone recommend a method, or extension, that will either keep the task iterations synchronised to their user story iterations automatically, or failing that, do it for all user stories/tasks in a product on demand?
Try TFS Aggregator
Example Uses
Update the state of a Bug, PBI (or any parent) to "In Progress" when a child gets moved to "In Progress"
Update the state of a Bug, PBI (or any parent) to "Done" when all children get moved to "Done" or "Removed"
Update the "Work Remaining" on a Bug, PBI, etc with the sum of all the Task's "Work Remaining".
Update the "Work Remaining" on a Sprint with the sum of all the "Work Remaining" of its grandchildren (i.e. tasks of the PBIs and Bugs in the Sprint).
Sum up totals on a single work item (ie Dev Estimate + Test Estimate = Total Estimate)
You can export all the work items in Excel and mass edit them into the new value.In order to do so, you need to maintain a work item query and have all WIs within one Team Project. Typically this is an activity that goes down during planning poker when a new iteration is about to start.I found this presentation by A.Bjork very useful on how to do (among other things) tasks like that.

Resources