Querying Work Items by their planned for / target (RTC Java API)
Hi,
I am trying to query work items that have a specific planned for / target but keep getting errors. I have tried the expression with both the name of the IIteration and the object itself (it's current state). Any help is much appreciated!
Here is my error currently:
com.ibm.team.repository.common.transport.ServiceMethodInvocationError: com.ibm.team.repository.common.query.QueryException: Unknown queryable field: target
and my code:
IWorkItemClient workItemClient = (IWorkItemClient) getTeamRepository().getClientLibrary(IWorkItemClient.class);
//Create a query factory
IQueryableAttributeFactory factory = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE);
IQueryableAttribute typeAttribute = factory.findAttribute(getProjectArea(), IWorkItem.TARGET_PROPERTY, getAuditableClient(), getMonitor());
//Begin writing our query expression
AttributeExpression typeExpression = new AttributeExpression(typeAttribute, AttributeOperation.CONTAINS, versions.get(14));
Term term= new Term(Operator.AND);
term.add(typeExpression);
//Execute query
IQueryClient queryClient = (IQueryClient) getTeamRepository().getClientLibrary(IQueryClient.class);
IQueryResult<IResolvedResult<IWorkItem>> result = queryClient.getResolvedExpressionResults(getProjectArea(), term, IWorkItem.FULL_PROFILE);
Comments
sam detweiler
Mar 06 '14, 11:21 a.m.did u try the iteration id (the string behind the label)
Liam White
Mar 06 '14, 11:27 a.m.like so?
ramesh m
Aug 22 '17, 5:50 p.m.HI White,
Navin R S
Aug 22 '17, 5:50 p.m.Hi Ramesh M,
I am also doing the same, trying to query work items that have a specific planned for.
Can you please share your solution if you have it already.
Thank you.
Regards,
Navin