Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to get estimate of the work item using plain Java API?

 Hi all,


I need to fetch "Estimate" of the workitem using plain Java API, I wrote following code:
IWorkItemCommon workItemCommon = (IWorkItemCommon ) teamRepository.getClientLibrary(IWorkItemCommon.class);
IAttribute built_in_duration = workItemCommon.findAttribute(DataRepository.getInstance().getProjectArea(), IWorkItem.DURATION_PROPERTY, monitor);
Object value = workItem.getValue(built_in_duration);  

but I received following exception:
java.lang.IllegalStateException: Attempting to get unset feature: Duration

Please help me on this point


0 votes



One answer

Permanent link

 You have to check if the item has a value, before you get a value, or handle the exception.


if (!workItem.hasAttribute(attribute)) {
}

The estimate is calculated based on settings in the project area process, based on the attribute ID's

Estimate ID: duration ValueType: duration
Corrected Estimate ID: correctedEstimate ValueType: duration
Time Spent(Time Remaining)  ID: timeSpent ValueType: duration

This is for the agile process templates.

0 votes

Comments

Thanks @Ralph Schoon thanks for your quick reply. I have estimate field in my workitem and some "xx" estimate is assigned for the workitem, still I get the mentioned exception.




Sorry to hear that, I have used this code and it worked for me. E.g.


In a server extension: https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/

There is also code in the WCL for this and it works for me. Check for has attribute and if there is one get the value. Otherwise assume it is not set.


Duration is a Long in milliseconds. There is no useful information in your comment to act upon. You should be able to easily debug this.

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937

Question asked: May 11 '20, 4:22 a.m.

Question was seen: 1,710 times

Last updated: May 11 '20, 9:56 a.m.

Related questions
Confirmation Cancel Confirm