It's all about the answers!

Ask a question

set value for custom attribute of type "workItem"


Moti Wertheimer (18913627) | 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 (58.2k23642) | 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 (58.2k23642) | 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.