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

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

0 votes



3 answers

Permanent link
 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.

0 votes


Permanent link
Hello,
you may also want to read https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Calculated_values

Thanks.
Eric.

0 votes


Permanent link
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)) {
    Object value = workItem.getValue(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

0 votes

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

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
× 369
× 43

Question asked: Feb 19 '13, 2:15 p.m.

Question was seen: 6,204 times

Last updated: Feb 26 '13, 6:04 a.m.

Confirmation Cancel Confirm