It's all about the answers!

Ask a question

How does one Get and Set value of Work Item's Found-In attribute programmatically?


1
1
Steven Melcher (6012832) | asked Jul 03 '12, 12:01 p.m.
edited Jul 03 '12, 1:26 p.m. by Geoffrey Clemm (30.1k33035)
In RTC 2.0, how do you get and set the value of a work item's Found In attribute using the Java API?

2 answers



permanent link
Ralph Schoon (63.6k33646) | answered Jul 04 '12, 3:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please have a look at: https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation

You can use the operation also to update work items, this saves you trying to work with working copies.

You want to set the value of the attribute: com.ibm.team.workitem.attribute.version the data type is IDeliverables.

Some hint on IDeliverables: https://jazz.net/library/article/807 there are several ways to find them.

permanent link
Ralph Schoon (63.6k33646) | answered Jul 04 '12, 3:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Forgot: To set an internal attribute:

            IWorkItemClient workItemClient= (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);
           
            IAttribute attribute = workItemClient.findAttribute(workItem.getProjectArea(),
                    fAttributeID, monitor);
            if(null!=attribute){
                if(workItem.hasAttribute(attribute))
                    workItem.setValue(attribute, fValue);
            }

To get use gatValue and cast. For custom attributes use hasCustomAttribute  which also works for built in attributes.

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.