Question about how to get custom attributes
![]()
Hi,
I am begginer with RTC Java API’s and I am having problems to load custom attributes values... I believe that my question is relative about concepts, but I already read some articles but the questions continue...
I found a lot of informations here: http://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ but didn't solve my questions...
I want to get custom attributes from IWorkItem, then i have:
<code>
....
//Search work items from project area here
List<IWorkItem> workItems = searchByProjectArea("Project Area X");
for (IWorkItem iWorkItem : workItems) {
IAttribute att = workItemClient.findAttribute(iWorkItem.getProjectArea(),
"attributeName", null);
// Shouldn't be workItemClient.findAttribute(iWorkItem, "attributeName", null)?????? My custom attribute is at workitem and not at project area
if (iWorkItem.hasAttribute(att )) {
System.out.println("OK!!!!!");
} else {
System.out.println("Error!!! Always stop here");
}
}
</code>
What it's wrong?
|
Accepted answer
![]()
its not attribute name, it attribute ID..
I always give my workitem attributes IDs I can figure out com.xx.workitem.attribute.name here is a link to my utility which prints out values of workitem attributes (workitems returned from query but not any different once u have the workitem) see the accepted answer here https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes watch out, the forum changes text case for anything near a < or > character, so when u cut/paste this into an eclipse project java file, you will get some errors Ralph Schoon selected this answer as the correct answer
|