It's all about the answers!

Ask a question

How to get workItemId by summary?

kishan adhi (44279) | asked May 02 '13, 3:53 p.m.
I want to search a work Item by summary?
I don't want to pull all the work Item and do search in the summary?

Is there any way i can get the list of work item ID whose summary matches to a text without pulling all the work Items .
I mean without using this code:-
        IQueryResult<IResolvedResult<IWorkItem>> results =
                queryClient.getResolvedExpressionResults(projectArea, expression,IWorkItem.FULL_PROFILE);

                String summary=workItem1.getHTMLSummary();

Above displayed code pulls all the work Item which I don't prefer because it is slow and I don't want to pull all the work items cause it might make java run out of memory.

Any kind of suggestion will be appreciated.


Accepted answer

permanent link
sam detweiler (12.5k6195201) | answered May 02 '13, 4:12 p.m.
you would have to use a different expression operation.. 

use the summary field, operation contains, and text data
kishan adhi selected this answer as the correct answer

kishan adhi commented May 02 '13, 8:40 p.m.

Can you post syntax or code

Thanks for your time

sam detweiler commented May 02 '13, 11:00 p.m.

haven't done it myself.  but these are shown to the user so there is probably some function there..

have u looked at the javadoc?

One other answer

permanent link
kishan adhi (44279) | answered May 03 '13, 9:14 a.m.
Thanks Sam
You are a live saver It did work with the concept you gave

For other who might need this code:
        Expression ismyType = new AttributeExpression(type1,AttributeOperation.CONTAINS, summary);
            IQueryResult<IResolvedResult<IWorkItem>> resultsResolvedss= queryClient.getResolvedExpressionResults(projectArea, ismyType, IWorkItem.FULL_PROFILE);
                int workItemID=workItem1.getId();
                    System.out.println("^*^ "+workItemID+"    "+workItem1.getHTMLSummary().getPlainText());

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.