It's all about the answers!

Ask a question

Get all possible values for Planned for attribute when creating a new work item?

ioana lazar (9810) | asked Aug 02 '12, 5:25 a.m.
retagged Aug 02 '12, 7:38 a.m. by Jared Russell (1.3k12019)
 Hey, I want to get the list with all possible values for the field planned for ( target property)I want all of the possible values, not  just for a certain work item, because for that I have getValue.

Ralph Schoon commented Aug 02 '12, 6:21 a.m. | edited Aug 02 '12, 6:21 a.m.

Ioana, sorry for the answer to the wrong post. I deleted the wrong answer here. And reposed it on the right question.

Accepted answer

permanent link
Jared Russell (1.3k12019) | answered Aug 02 '12, 7:34 a.m.
edited Aug 02 '12, 7:37 a.m.
I believe that the following should work however I've not tested it:

URI projectAreaUri = ...
IProcessClientService processClient = (IProcessClientService) repository.getClientLibrary(IProcessClientService.class);
IAuditableClient auditableClient = (IAuditableClient) repository.getClientLibrary(IAuditableClient.class);
IProjectArea projectArea = (IProjectArea) processClient.findProcessArea(projectAreaUri, null, null);
IDevelopmentLineHandle[] developmentLineHandles = projectArea.getDevelopmentLines();
for(IDevelopmentLineHandle developmentLineHandle : developmentLineHandles) {
	IDevelopmentLine developmentLine = auditableClient.resolveAuditable(developmentLineHandle, ItemProfile.DEVELOPMENT_LINE_DEFAULT, null);
	for(IIterationHandle iterationHandles : developmentLine.getIterations()) {
		IIteration iteration = auditableClient.resolveAuditable(iterationHandles, ItemProfile.ITERATION_DEFAULT, null);

If you're only interested in the main project timeline you can call IProjectArea#getProjectDevelopmentLine() instead.
Ralph Schoon selected this answer as the correct answer

ioana lazar commented Aug 02 '12, 9:00 a.m.

Thanks. The thing is that with this solution I get only the main iteration names and I need all possible values, including the children of the each iteration.

Ralph Schoon commented Aug 02 '12, 9:07 a.m.

Have you looked at the methods of IIteration? Try iteration.getChildren() to get the next lower level.

ioana lazar commented Aug 02 '12, 9:14 a.m.

Yes. I'm just using it right now to see if it works.

ioana lazar commented Aug 02 '12, 9:41 a.m.

Hey. It works with the getChildren(). It got me what I needed, the only thing is that when I look in RTC and when I look at my printed list some values are not always the same. I need to investigate that. I am using iterationChild.getName(). But overall, the answer above is the right one. Thank you again.

Your answer

Register or to post your answer.