Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Find a work item by attribute through java api

Hello,

I want to create an operation advisor to add a link between the current work item and some other work item.

I need to query RTC to find the other work item (thus get its IWorkItem instance). How can I do this?

The query must be by the work item type and an attribute.

Thanks for the help.

0 votes


Accepted answer

Permanent link
see this topic
https://jazz.net/forum/questions/161814/search-workitems-based-on-the-value-of-the-custom-attribute
and this answer 
Sujith Gannamaneni (164) | answered Aug 27, 11:03 a.m.

and Ralph's blog
https://rsjazz.wordpress.com/2012/10/29/using-work-item-queris-for-automation/

these are client side examples, but not too much different on the server side
Thiago Barreto selected this answer as the correct answer

2 votes

Comments

Sam, thanks for the answer. It has been very helpful.

Do you know how can I retrieve an instance of IQueryCommon on the server side?

It seems to be necessary to execute the query. Or do you know if there is another way?

    private static IQueryService fQueryService = null;
            fQueryService = getService(IQueryService.class);
how I use it
the query is the expression and and/or terms.

IQueryPage qpage = fQueryService.queryItems(query, new IProjectAreaHandle[] { ProjectAreaHandle }, IQueryService.ITEM_QUERY_MAX_PAGE_SIZE);

also need to add the service to the plugin required service list in the plugin.xml
         

Thanks again, Sam

I ended up using getService(IQueryCommon.class) to retrieve an IQueryCommon instance and added it to plugin.xml as a required service.


Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937

Question asked: Sep 01 '14, 9:59 a.m.

Question was seen: 2,772 times

Last updated: Sep 02 '14, 3:00 p.m.

Confirmation Cancel Confirm