It's all about the answers!

Ask a question

Get the Planned For Value set in a Work Item from Java API

Tiago Fernandez (5351619) | asked Oct 04 '13, 3:46 p.m.


for example I have an WorkItem number xxxx which the value of the Planned For field is "Release 1.0".

What I need is to get from my script is the value "Release 1.0" for that work item number,

Is there some few lines of code simple to do that? (I already have the workitem variable available in my script)

Thanks a lot for the help.

Accepted answer

permanent link
Ralph Schoon (63.2k33646) | answered Oct 05 '13, 7:01 a.m.
edited Oct 05 '13, 7:01 a.m.
In Java you can access this data as described here: . lab 5 provides you with guidance and information with respect to JavaScript. The spy script should show how to access built in attributes and what you actually can access. explains it also, also the limitations. 


Is the id to use.
Tiago Fernandez selected this answer as the correct answer

Tiago Fernandez commented 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.

Ralph Schoon commented Oct 05 '13, 1:26 p.m.

It would make sense, if you provided the info around groovy in the question. Otherwise it becomes confusing with all the different environment. 

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.