It's all about the answers!

Ask a question

set value for custom attribute of type "workItem"


Moti Wertheimer (18913628) | asked Feb 05 '15, 4:30 a.m.
JAZZ DEVELOPER
edited Feb 05 '15, 4:32 a.m.
 I have a custom attribute of type "workItem"
Trying to set value in Java plain client like this:
//wc is working copy
IWorkItem workItemNew = wc.getWorkItem();
IAttribute backportAttirbute = RhpWorkitemUtils.getCustomAttribute("backport", workItemNew);
workItemNew.setValue(backportAttirbute, workItemOrig); //workItemOrig is existing workitem
//continue with save as usual

The code does not throw any exception, but I see no effect in the workitem.
Other custom attributes are being set well.
Looks like I am missing how to correctly modify this type.

Accepted answer


permanent link
Ralph Schoon (63.1k33645) | answered Feb 05 '15, 5:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
We figured Moti's code was OK, but the presentation configuration was wrong, so it did not show anything.
Ralph Schoon selected this answer as the correct answer

One other answer



permanent link
Ralph Schoon (63.1k33645) | answered Feb 05 '15, 4:38 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Moti,

you can find examples for how that API works here: https://rsjazz.wordpress.com/2015/01/12/a-rtc-workitem-command-line/

You have to return an IWorkItem. Your code looks OK to me. Here is some code that works for me.
		HashMap workItems = findWorkItemsByIDValues(
				parameter.getValue(), notFoundList, ITEM_SEPARATOR);
		Collection workItemList = workItems.values();
		if (workItemList.size() > 0) {
			return workItemList.iterator().next();
		} else {

The code then uses the setValue to set the attribute like yours does.

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.