About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Welcome to the Jazz Community Forum
How do I find the Current Iteration of a Project Area with the Java Server API?

Accepted answer

I solved the issue by just casting an IProcessArea as an IProjectArea.
IProjectArea projectArea = (IProjectArea) operation.getProcessArea();
I added this line to the beginning of the run method of my extension and then was able to use IProjectArea's getDevelopmentLines() and IDevelopmentLine's getCurrentIteration() calls to get the current iteration.
One other answer

Relevant code to answer your question:
- IProjectArea has .getDevelopmentLines() and .getProjectDevelopmentLine()
- IDevelopmentLine has .getCurrentIteration() which returns the current iteration.
- IIteration has .getDevelopmentLine()
Comments

I'm able to get the IProjectAreaHandle from workitem.getProjectArea() but when I try to use the IRepositoryItemService.fetchItem() to get the full item from the handle, I get a null value. How do I actually get an IProjectArea object to begin that chain?

IProjectArea projectArea = (IProjectArea) repositoryItemService.fetchItem(workItem.getProjectArea(), IRepositoryItemService.COMPLETE);
Per the Javadoc, the return value 'cannot' be null... so perhaps you are calling a different method. Note: It can however throw one of several Exceptions (is it possible you are just catching that and continuing?),

Ex:
* @return the item for the given item handle; the item has all its
properties set of <em>properties</em> is <code>COMPLETE</code>;
otherwise, the item is partial with the specified properties set;
the item is immutable; never <code>null</code>
* @throws PermissionDeniedException
if authenticated contributor is not authorized to read this
item from the repository
* @throws ItemNotFoundException
if the item was not found