It's all about the answers!

Ask a question

How to set an Iteration as Current Iteration programatically

Rachid Halloul (144) | asked Sep 17 '12, 10:56 a.m.
I'm trying to set an Iteration as current iteration but it did not work, here is a code simple.

IIteration newIteration = (IIteration) IIteration.ITEM_TYPE.createItem();
 IDevelopmentLine workingDevLine  = (IDevelopmentLine) line.getWorkingCopy() ;
workingDevLine.setCurrentIteration(newIteration); IProcessItem[]{iter, newIteration}, monitor);

Any idea?


One answer

permanent link
Parker Dunton (4064) | answered Sep 17 '12, 1:22 p.m.
Hi Rachid,

From your code it does not look like you are saving the development line after setting the current iteration. You will need to save the dev line as well as the new iteration.

Rachid Halloul commented Sep 17 '12, 2:22 p.m. | edited Feb 26 '17, 6:18 p.m.

Hi Parker,

when I tried to save the development line, I got the following exception : Iteration 'Corticon Sprint 34' has a parent 'Next Release', but its parent doesn't consider it a child.
    at sun.reflect.GeneratedMethodAccessor122.invoke(null)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(

Parker Dunton commented Sep 18 '12, 11:50 a.m.

Sounds like you need to add the iteration to the dev line as well, try IDevelopmentLine#addIteration(IIterationHandle iteration)

Rachid Halloul commented Sep 19 '12, 9:38 a.m. | edited Feb 26 '17, 6:18 p.m.

still same error message even after adding the iteration to DevelopmentLine. Any idea ?


Parker Dunton commented Sep 19 '12, 12:27 p.m.

If you read the documentation for IDevelopmentLine#addIteration it indicates that you also must call IIteration#setDevelopmentLine(IDevelopmentLineHandle developmentLine) on the iteration. Are you doing this?

Rachid Halloul commented Sep 19 '12, 3:24 p.m.

here is the code sample workingDevLine.getWorkingCopy(); workingDevLine.setName(iter.getName()); newIteration.setDevelopmentLine(workingDevLine); workingDevLine.insertIterationAfter(newIteration, iter); iter.addChild(newIteration); workingDevLine.addIteration(newIteration); workingDevLine.setCurrentIteration(newIteration); IProcessItem[]{newIteration,workingDevLine}, monitor);

iter is the Release iteration (parrent) and the newIteration is the child,

Rachid Halloul commented Sep 20 '12, 1:46 p.m.

Hi Parker,

I was able to figure out the issue, I was not getting a working copy of the parent iteration.

Thanks of your help.

showing 5 of 6 show 1 more comments

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.