How to fetch WorkItems based on "Found In" (release) value?
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);
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
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.
This is, of course, true for all attribute types that are not strings.