It's all about the answers!

Ask a question

Server Side API : saveParameter.getNewReferences() is not able to identify Contributes To (trackedBy) link

Shwetha G (5016) | asked Feb 23 '17, 6:07 a.m.

Hello All,

We are developing a server side plugin, which checks for the linked type and its workitems.

we are able to get all the link types and its linked workitems, but not "Contributes To" link.

following is the code :
IWorkItemReferences ref = saveParameter.getNewReferences();
                        List<IReference> listReferences = ref.getReferences(linkDescriptor);

Here the listReference, size is zero, though we have added the workitem using "Contributes To" link.

Is there any issue with the cross project and the link type "Contribute to" link ?

but, with the same cross project, the code is working for tracks link :(

please assist me on this.


Ralph Schoon commented Feb 23 '17, 7:14 a.m.

"Contributes To" is basically the other direction of "Tracks" so I would assume both would work. I think I tried it in direction tracks and it worked for me back then. 

Shwetha G commented Feb 27 '17, 3:36 a.m.

Thanks for the reply Ralph.

But the following code,is not able to identify the workitems that are linked using "Contributes to".

IEndPointDescriptor linkDescriptor =  WorkItemEndPoints.TRACKS_ITEMS;
IWorkItemReferences ref = saveParameter.getNewReferences();
List<IReference> listReferences =ref.getReferences(linkDescriptor);

though i have linked two workitems using "contributes to" link, the

listReferences size is zero.

Could you please suggest me, if there are any other APIs, for fetching the list of workitems that works for all the link types.

Accepted answer

permanent link
Luca Martinucci (942277108) | answered Feb 27 '17, 11:32 a.m.

I would try these code snippets to retrieve source and target endpoints:

IEndPointDescriptor tracks = ILinkTypeRegistry.INSTANCE.getLinkType("").getSourceEndPointDescriptor();
IEndPointDescriptor contributesTo = ILinkTypeRegistry.INSTANCE.getLinkType("").getTargetEndPointDescriptor();

Shwetha G selected this answer as the correct answer

Shwetha G commented Feb 27 '17, 11:48 p.m.

Thanks a lot Luca....This worked for me.

Shwetha G commented Feb 28 '17, 1:10 a.m.

Hello Luca,

I would like to know how this mapping is happening : 
 For tracks").getSourceEndPointDescriptor();

For Contributes to").getTargetEndPointDescriptor();

Here is for Contributes to.

How you decide as which is source and target ?

I had applied the similar way using :

Tracks :;
Contributes To :;

The above didnt work for me.

Please help me understand this.

Luca Martinucci commented Feb 28 '17, 3:24 a.m.

using the Java SDK (see my other answer) I retrieved the list of link types and their enpoints.
So, I found:

SOURCE: Tracks (tracks)
SOURCE ITEM TYPE: WorkItem ( (namespaceURI:, name: WorkItem, abstract: false))
TARGET: Contributes To (trackedBy)

SOURCE: Contributes To (trackedBy)
SOURCE ITEM TYPE: WorkItem ( (namespaceURI:, name: WorkItem, abstract: false))
TARGET: Tracks (tracks)

It seems that  and are complementary.
If you start from, "Tracks" is the target, "Contributes To" is the source.

3 other answers

permanent link
Ralph Schoon (57.7k23642) | answered Feb 27 '17, 11:01 a.m.

This post explains the link API for these kinds of links: 

Here the other link API related posts:

I would suggest to use a small RTC Client library tool to develop the API to detect the links. Run through all links the work item has. Then check what endpoints which has.

The Client link API and the server link API should be pretty much the same.  In the client use the IWorkItemCommon instead of IWorkItemClient. Once you understand how the links work, take it into the server extension.

permanent link
Luca Martinucci (942277108) | answered Feb 28 '17, 3:25 a.m.

Shwetha, this is code with which I retrieved the links types:

Collection linkTypesCollection = ILinkTypeRegistry.INSTANCE.allEntries();
Iterator linkTypesCollectionIterator = linkTypesCollection.iterator();
while (linkTypesCollectionIterator.hasNext()) {
    ILinkType currentLinkType = (ILinkType);
    String linkTypeID = currentLinkType.getLinkTypeId();
    IEndPointDescriptor source = currentLinkType.getSourceEndPointDescriptor();
    IEndPointDescriptor target = currentLinkType.getTargetEndPointDescriptor();
    System.out.println("LINK TYPE ID: " + linkTypeID);
    System.out.println("SOURCE: " + source.getDisplayName() + " (" + source.getId() + ")");
    if (source.isItemReference()) {
        IItemType referencedItemType = source.getReferencedItemType();
        String referencedItemTypeName = referencedItemType.getName();
        System.out.println("SOURCE ITEM TYPE: " + referencedItemTypeName + " (" + referencedItemType.toString() + ")");
    System.out.println("TARGET: " + target.getDisplayName() + " (" + target.getId() + ")");
    if (target.isItemReference()) {
        IItemType referencedItemType = target.getReferencedItemType();
        String referencedItemTypeName = referencedItemType.getName();
        System.out.println("TARGET ITEM TYPE: " + referencedItemTypeName + " (" + referencedItemType.toString() + ")");

permanent link
Ralph Schoon (57.7k23642) | answered Feb 28 '17, 3:42 a.m.
edited Feb 28 '17, 3:42 a.m.

The Link types and endpoints are defined as follows:

1. For Work Item link types (wi to wi only within a repository):

Example WorkItemEndPoints.PARENT_WORK_ITEM

This does not contain the endpoints for
2. For CLM Link types (cross repository, cross application):

.getTargetEndPointDescriptor() contains also all the other endpoint definitions, so you can create all link points using the pattern


Your answer

Register or to post your answer.