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.
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.4k314) | answered Jul 03 '16, 10:00 p.m.
How about Ralph's blogs?

permanent link
Hakki Bozkurt (1631126) | 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.