It's all about the answers!

Ask a question

How to fetch WorkItems based on "Found In" (release) value?


Sridhar Kuna (1602017) | asked Sep 14 '15, 6:47 a.m.
edited Sep 14 '15, 12:47 p.m.
The below code didn't work for me. Please let me know what variable that need to pass to expression to get value found in? how it can be done?

WorkItemTypeVariable variable = new WorkItemTypeVariable("Release1");
IQueryableAttribute foundInAttribute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectArea, IWorkItem.FOUND_IN_PROPERTY, auditableClient, monitor);
Expression foundInExpression = new AttributeExpression(foundInAttribute, AttributeOperation.EQUALS, variable);
Term term = new Term(Operator.AND);
term.add(foundInExpression);
com.ibm.team.workitem.common.query.IQueryResult<IResolvedResult<IWorkItem>> results = queryClient.getResolvedExpressionResults(projectArea, term, IWorkItem.FULL_PROFILE);

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Sep 15 '15, 2:32 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Sep 15 '15, 2:34 a.m.
As stated in the answer to your question https://jazz.net/forum/questions/206015/how-to-get-the-workitems-based-on-filed-against-value you can't just put in a string. You have to find the object using the string from all the existing releases and pass the object or handle.

This is, of course, true for all attribute types that are not strings.
Sridhar Kuna selected this answer as the correct answer

Comments
Ralph Schoon commented Sep 15 '15, 3:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

From my latest version of https://rsjazz.wordpress.com/2015/02/09/a-rtc-workitem-command-line-version-2/


    /*
     * Find a deliverable (release) object from its name Deliverables don't have
     * ID's, so you can only search for the value.
     * 
     * @param value
     *            - the name of the deliverable
     * @return the deliverable object
     * @throws TeamRepositoryException
     /
    private IDeliverable findDeliverable(String value)
            throws TeamRepositoryException {
        return getWorkItemCommon().findDeliverableByName(
                getWorkItem().getProjectArea(), value,
                IDeliverable.FULL_PROFILE, monitor);
    }

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.