It's all about the answers!

Ask a question

Obtain the Planned For Value of a Given WorkItem with Java Plain API

Tiago Fernandez (5351619) | asked Oct 03 '13, 4:15 p.m.
edited Oct 03 '13, 4:31 p.m.

I'd like to obtain the Planned For value set of a given workItem and print it in console as String.
how do I get it?

Thanks a lot for the help.

Accepted answer

permanent link
Ralph Schoon (63.3k33646) | answered Oct 04 '13, 1:39 a.m.
Tiago Fernandez selected this answer as the correct answer

Tiago Fernandez commented Oct 04 '13, 2:13 p.m.

Thank you for the response.

But for example I have an WorkItem number xxxx which the value of the Planned For field is "Release 1.0".
What I want to get in my script is the value "Release 1.0" for that work item number,
Do I have to set all that classes and code (like the link example) just to get that value?
Isn't there some few lines of code to do that more simple?

Thank you very much.

Tiago Fernandez commented Oct 05 '13, 11:22 a.m. | edited Oct 05 '13, 11:23 a.m.

It was a little hard for me, but I could figure out how to obtain the Planned For value of a workitem using the class PathHelper of your example of the link. I did:

Already having the iAttribute....

 def plannedForHandle = workItem.getValue(iAttribute)
 PathHelper ph = new PathHelper(repo, new SysoutProgressMonitor());
 String paths = "IDPath: [" + ph.toIDPathString() + "] NamePath: (" + ph.toNamePathString() + ")";
 println "Planned For result is : " + paths

Thanks a lot for the help.

PS: My script is groovy, so I implemented the java way.

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.