It's all about the answers!

Ask a question

Fetch Workitems which are modified last 24 hours(1day)

Sridhar Kuna (1602017) | asked Sep 03 '15, 7:13 a.m.
We want to retrieve workItems modified from yesterday (last 24 hours). We have tried as below but it didn't fetch WI's correctly. Please let us know what can be wrong? Not sure IWorkItem.MODIFIED_PROPERTY is the correct one to declare here.

Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -1);
Date yesterdayDate = cal.getTime();
Timestamp yesterdayTimestamp = new Timestamp(yesterdayDate.getTime());
IQueryableAttribute lastModifiedAttribute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectArea, IWorkItem.MODIFIED_PROPERTY, auditableClient, monitor);
Expression lastModifiedExpression = new AttributeExpression(lastModifiedAttribute, AttributeOperation.AFTER, yesterdayTimestamp);<IResolvedResult<IWorkItem>> results = queryClient.getResolvedExpressionResults(projectArea,  lastModifiedExpression, IWorkItem.FULL_PROFILE);

Sridhar Kuna commented Sep 03 '15, 7:16 a.m.

By the way, Workitem modification can be any kind of change either new comment addition, status change or any attribute values changes etc...

One answer

permanent link
Ralph Schoon (63.1k33646) | answered Sep 03 '15, 10:55 a.m.
I would assume that that is the correct property. Have you tried that out?

Sridhar Kuna commented Sep 03 '15, 11:48 a.m.

Thanks for your reply Ralph. I have tried it but it is only considering day not the full timestamp. i mean it is retrieving all workitems modified from yesterday(on yesterday date) but not from yesterday timestamp.

sam detweiler commented Sep 03 '15, 12:35 p.m.

yes, the filter only uses day.. not time. so you cannot get the rolling last 24 hours exactly.

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.