It's all about the answers!

Ask a question

Example code to retrieve related workitems from a workitem? Java API


Srinivas Mandava (15815) | asked Jul 03 '16, 7:38 p.m.
JAZZ DEVELOPER
I would like to retrieve all related workitems/Workitem IDs from a workitem.
For example:-
If workitem 10 has related workitems 11, 12, 13.I would like to retrieve all related workitems 11, 12, 13 from 10.Any example code I can make use of ?

2 answers



permanent link
Donald Nong (14.5k614) | answered Jul 03 '16, 10:00 p.m.
How about Ralph's blogs?
https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/
https://rsjazz.wordpress.com/2012/09/20/the-rtc-workitem-server-link-api-linking-to-work-items-and-other-elements/

permanent link
Hakki Bozkurt (1631228) | answered Jul 04 '16, 4:17 a.m.
you can use this code part (for precondition plugins)

ILinkService linkService = (ILinkService) getService(ILinkService.class);
ILinkServiceLibrary linkLibrary = (ILinkServiceLibrary) linkService.getServiceLibrary(ILinkServiceLibrary.class);
IItemReference workItemRef = IReferenceFactory.INSTANCE.createReferenceToItem(sourceworkItem);
ILinkQueryPage linkPage = linkLibrary.findLinks(WorkItemLinkTypes.RELATED_WORK_ITEM, workItemRef);
ILinkCollection relatedWorkItems = linkPage.getAllLinksFromHereOn();

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.