It's all about the answers!

Ask a question

How we can fetch work item change sets using client API?


Rinkal Garg (1719) | asked Mar 21 '18, 5:49 a.m.
edited Mar 21 '18, 8:50 a.m.

 If there is any other way to find out change sets using work item Id. Please help

Accepted answer


permanent link
Ralph Schoon (63.1k33645) | answered Mar 21 '18, 9:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Yes, you can find the work item using its ID. Then you iterate the links of that work item and finds the ones that are to a change set. Then you can identify the change set and do whatever needed with it.


How to use IWorkItemCommon.findWorkItemById() to find a work item by ID is explained in https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/.

https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ explains how to follow links. This is example code to find the handles

for (IReference reference : references) {
    if (reference.isItemReference()) {
        IItemHandle refItem = (IItemHandle) reference.resolve();
        if (refItem instanceof IChangeSetHandle) {
            ....(IChangeSetHandle) refItem;
        }
    }
}
Rinkal Garg selected this answer as the correct answer

Comments
Rinkal Garg commented Mar 22 '18, 2:36 a.m. | edited Mar 22 '18, 3:34 a.m.

Now I have links collection with me, and I am using the below code to find change set :
Collection<ILink> links = linkCollection.getLinksById("com.ibm.team.filesystem.workitems.change_set");
 But every time it returns blank list. Please help. 


Rinkal Garg commented Mar 26 '18, 3:03 a.m.

@Ralph any suggestion?


Ralph Schoon commented Mar 26 '18, 4:32 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I have provided you with several links to blog posts. One of them was around the link API. As far as I remember the code there iterates over all link types and can print information. I created the code because I was not sure what to expect. Maybe you want to follow that example.

One other answer



permanent link
arif ahnan (11) | answered Mar 26 '18, 5:47 a.m.
edited Mar 26 '18, 5:53 a.m. by Ralph Schoon (63.1k33645)

 this is very helpful once thanks sir Ralph Schon



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.