Example code to retrieve related workitems from a workitem? Java API
2 answers
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();