It's all about the answers!

Ask a question

How get "Found In" attribute with RTC SDK?


Dmitry A. Lesin (24825996) | asked Apr 01 '14, 6:36 a.m.
edited Apr 01 '14, 6:48 a.m.
Hello!
We develop a follow-up action trigger which gets the attributes (names and values) from workitems which are changed. We can get almost any attributes for an RTC workitem. But we can not find "Found In" attribute (or release number) which is defined in releases list of a project area.
Can anybody recommend us how we can get this value from IWorkItem or another way?
The environment is Jazz CLM v4.0.5.
Thank you in advance!

Accepted answer


permanent link
Lukas Steiger (3131626) | answered Apr 01 '14, 6:51 a.m.
edited Apr 01 '14, 6:52 a.m.
 Simply use
IWorkItemClient workItemClient = ((IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class));
IAttribute attribute = workItemClient.findAttribute(projectArea, attributeId, null);
To find out the attributeId do the following:
- Open the project area in the eclipse client
- Choose 'Process Configuration' tab
- Navigate to  Project Configuration -> Configuration Data -> Work Items -> Types and Attributes
- click a built-in attribute and choose Edit
- instead of the whole ID path (like 'com.ibm.team.workitem.attribute.modified'), only use the last part ('modified').
---> for custom attributes, you have to use the whole path (like in the source code above)

(a part of this answer is from my answer on this topic)
Dmitry A. Lesin selected this answer as the correct answer

Comments
Dmitry A. Lesin commented Apr 01 '14, 6:55 a.m.

Hi Lucas,
I was having a suspicion that I need to go this way but I stopped my investigation too earlier!
Thank you very much! I'm sure this topic will be helpful for other who goes this way.


Lukas Steiger commented Apr 01 '14, 7:00 a.m.

 The advantage if this code is that it is generic for built in and custom attributes, that's why I prefer it over the approach Susan Hanson suggests below.

One other answer



permanent link
Susan Hanson (1.6k2201194) | answered Apr 01 '14, 6:53 a.m.
I don't actually read it, but I do set it using this logic:
            IAttribute foundInAttr = myRepo.findAttribute(IWorkItem.FOUND_IN_PROPERTY);
            IDeliverable del = myRepo.workItemClient.findDeliverableByName(myRepo.projectArea, name, IDeliverable.DEFAULT_PROFILE, myRepo.monitor);
            newWorkItem.setValue(foundInAttr, deliverable.getItemHandle());

I would assume once you have the foundInAttr, you could do something like
IDeliverable del = (IDeliverable) oldWorkItem.getValue(foundInAttr);


Comments
Ralph Schoon commented Apr 01 '14, 7:01 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I would also suggest to use the IWorkItem interface to get at the constants for the built in attributes. E.g. IWorkItem.FOUND_IN_PROPERTY


Dmitry A. Lesin commented Apr 01 '14, 7:27 a.m.

Colleages!
Thank you very much to everybody!
And I'm sorry! I'd like accept all answers but System doesn't let me to do it!

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.