getting value of custom attribute programmatically
Hi All,
I have added a custom attribute to the work item UI(defect). I am trying to programmatically retrieve the value of the custom attribute selected by the user. The custom attribute is a drop down menu populated with certain defined enumeration. Could anyone please guide me on how to retrieve this value? Thanks, Ananya |
3 answers
Ralph Schoon (63.3k●3●36●46)
| answered Feb 19 '13, 2:26 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please see this post: https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/
You first find the IAttribute using the ID and then you getValue the value.
It is irrelevant if the values are in a drop down list. That is just a presentation. In the API you typically just get the value from the work item.
|
Hello,
you may also want to read https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Calculated_values Thanks. Eric. |
Thank you both for replying.
Ralph, I checked the blog. I was trying to get the value of iAttribute in the following.
if (workItem.hasAttribute(iAttribute)) {
Since AttributeImpl implements IAttribute, I tried using methods defined in the class, but since its constructor is protected I couldn't use it to get the value. Is there any other way round, I can retrieve iAttribute? Thanks, Ananya Comments Almost the first code in the post https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ talks about findAttribute() .
IWorkItemClient workItemClient = (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class); IAttribute someAttribute= workItemClient.findAttribute(fProjectArea, "some_attribute_ID", monitor); So you use the ClientLibary or the Service to find the attribute. The server API, if you are in a participant or advisor is described here: https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ |
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.