It's all about the answers!

Ask a question

How to Get all Parents WorkItems given a specific WorkItem with Java API?


Tiago Fernandez (5351619) | asked Oct 17 '13, 11:33 a.m.

Hello all,

How to get all parents workitems hireachy of a given work item using Java API, for example:

Epic: 1234
      |__ Story: 4567
                  |__ Task: 7894
                              |__ Another Sub Task: 7458

So given the  Sub Task: 7458    workitem handler, I'd like to get the parents up to the root:    7894, 4567 and 1234

The result of each of them can be the workitem handler and then I can get the ID number.

Thanks a lot for the help.

One answer



permanent link
Ralph Schoon (63.1k33645) | answered Oct 17 '13, 12:59 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Comments
Tiago Fernandez commented Oct 17 '13, 3:07 p.m.

Thanks for the response,
I could figure a part of the code out, but I need a part I don't know how to do it.

Part of the code I have is:

queryPage = linkManager.findLinksBySource(WorkItemLinkTypes.PARENT_WORK_ITEM, workItemRef, null);
  links = queryPage.getAllLinksFromHereOn();
  for(ILink l : links){ 
   println("Link Comment is: " + l.getTargetRef().getComment())

  }

This gives me the number of the parent WorkItem plus its title.
How can I get the IWorkItem Parent handler in my code from the ILink l?

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.