Welcome to the Jazz Community Forum
JavaPlainApi get workItem references from workItemCopy is always null

I'm developing a RTC Client with the Java Plain API 4.0.1. The client gets a WorkItem by Id and then it uses a WorkItemOperation for getting the current references and performing some modifications but the workitem references are always null although I can see the WI has links to other WIs on the web browser. ¿What else is needed for getting de references?
private static class WorkItemReferencesModification extends WorkItemOperation {private IWorkItemHandle fOpposite; public WorkItemReferencesModification() { super("Modifying Work Item References",IWorkItem.FULL_PROFILE); } @Override protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor) throws TeamRepositoryException { IEndPointDescriptor endpoint = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes2.CUSTOM_LINK).getTargetEndPointDescriptor(); workingCopy.getReferences().getReferences(endpoint); // THIS IS ALWAYS NULL!!! } </pre>
2 answers

I have published how that worked for me here
https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/
and here
https://rsjazz.wordpress.com/2012/10/20/following-calm-links-using-the-java-client-or-server-api/

Hi Ralph, actually I read both articles and on other RTC 5.0.2 I have a client where this works right. But on this RTC 4.0.1 references come empty. I used your method analyzeReferences(IWorkItemReferences references) but on List endpoints = references.getTypes(); does not return any type.
In addition I tried force resolving references from WorkItem getting from WorkItemCopy with:
IWorkItemCommon common= (IWorkItemCommon) ((ITeamRepository)workItem.getOrigin()).getClientLibrary(IWorkItemCommon.class); IWorkItemReferences references = common.resolveWorkItemReferences(workItem, null);Maybe if I use IQueryResult the references could come resolved.