How can I get the currentIteration from a server-side participant?
I'm trying to set the PlannedFor based on the current iteration during auto-generation of a workitem from a server-side participant. I am struggling getting the currentIteration on the server side (I have plenty of code that gets it on the client side).
I can get the IDevelopmentLineHandle from the project are of the work item, but then I hit issues getting down to the currentIteration:
IDevelopmentLineHandle devLine = ipa.getProjectDevelopmentLine();
IDevelopmentLine dev = (IDevelopmentLine)itemService.fetchItem((IItemHandle)devLine, null);
IIterationHandle ciHandle = dev.getCurrentIteration();
IIteration iter = (IIteration)itemService.fetchItem((IItemHandle)dev, null);
..that last line gives an error so I can't actually get the information for the currentIteration.
I can get the IDevelopmentLineHandle from the project are of the work item, but then I hit issues getting down to the currentIteration:
IDevelopmentLineHandle devLine = ipa.getProjectDevelopmentLine();
IDevelopmentLine dev = (IDevelopmentLine)itemService.fetchItem((IItemHandle)devLine, null);
IIterationHandle ciHandle = dev.getCurrentIteration();
IIteration iter = (IIteration)itemService.fetchItem((IItemHandle)dev, null);
..that last line gives an error so I can't actually get the information for the currentIteration.
Accepted answer
2 other answers
is there only one timeline (getProjectDevelopmentLine gets the one set as the Project timeline, but there doesn't HAVE to be one set that way)
also, just the picky in me... fetchItem() takes a list of properties or RepositoryItemService.COMPLETE if all
I know RepositoryItemService.COMPLETE= null.. but
also, just the picky in me... fetchItem() takes a list of properties or RepositoryItemService.COMPLETE if all
I know RepositoryItemService.COMPLETE= null.. but
Comments
I know little about your case. But if you want to set Planned For to the current iteration for a workitem, I believe you should firstly figure out what team area owns this workitem because different team area can be working on different timeline. You can use IProcessServerService.getDevelopmentLine(IProcessArea) to get the timeline for a given process area and then find the current iteration in this timeline.
However, if you are not using team area or all the team areas are working on the same project development timeline, please ignore what I mentioned above.