It's all about the answers!

Ask a question

How to get all work items by passing planned for attribute


Navin R S (13512) | asked Sep 14 '17, 4:09 a.m.

Hi

How to get all work items by passing planned for attribute by using java api in alm rtc

One answer



permanent link
Ulf Arne Bister (1.3k213) | answered Sep 14 '17, 10:15 a.m.

Hi,

please find a very good description of this in Ralph Schoon's Blog: Query Models with API

If this answers your question please mark it accepted.

- Arne


Comments
Navin R S commented Sep 14 '17, 11:26 p.m.
  I am also trying to fetch the work items based on the current sprint,
I am also getting java.lang.IllegalArgumentException: Argument must be an instance of IAuditableHandle .
below is my code,

IWorkItemClient workItemClient = (IWorkItemClient) iTeamRepository.getClientLibrary(IWorkItemClient.class);
IAuditableCommon iAuditableCommon = (IAuditableCommon) iTeamRepository.getClientLibrary(IAuditableCommon.class);

IQueryableAttribute planAttribute = factory.findAttribute(projectArea, IWorkItem.TARGET_PROPERTY, iAuditableCommon, monitor);
Expression plan = new AttributeExpression(planAttribute, AttributeOperation.EQUALS, CurrentMilestoneVariable.VARIABLE_ID);
Term term = new Term(Term.Operator.AND);
term.add(plan);
IQueryDescriptor iQueryDescriptor = queryClient.createQuery(projectArea, QueryTypes.WORK_ITEM_QUERY, "AllItems", term);

Your answer


Register or to post your answer.