Is there a TFS query macro for the current iteration?

Glenn Slaven picture Glenn Slaven · Jan 19, 2010 · Viewed 13.9k times · Source

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?

Answer

Dane picture Dane · Jun 5, 2015

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:

TFS query of work items Under the backlog iteration node, but not equal to the backlog iteration node. Also not Closed.

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.