It's all about the answers!

Ask a question

WI attribute customization: get custom attribute value


Russell Norlund (17221724) | asked Nov 07 '11, 7:04 a.m.
In work item customization getting the value of a built in attribute is straight forward i.e. com.ibm.team.workitem.api.common.WorkItemAttributes class which contains the the string constants that are used to access built-in attributes of work items such as SEVERITY, PRIORITY etc.

Is there any other class which you can use to get the values of custom attributes?

19 answers



permanent link
Henry Armburg Jennings (13076) | answered Nov 18 '11, 12:52 p.m.
Thanks for posting. I had no time to try....


No problem! It returns a UUID rather than a String though, how do I convert it?

permanent link
sam detweiler (12.5k6195201) | answered Nov 18 '11, 1:01 p.m.
workitem.getCategory();
then lookup the handle to get the human readable value

Sam

permanent link
Henry Armburg Jennings (13076) | answered Nov 18 '11, 4:00 p.m.
workitem.getCategory();
then lookup the handle to get the human readable value

Sam


workitem.getCategory() did not work I'm afraid and I'm still having trouble converting the UUID I get from "workItem.getValue(WorkItemAttributes.FILED_AGAINST)". As far as I'm aware, this should not return a UUID?

Even calling 'toString()' on it returns the same value, namely, '_O7KQEvZmEeC94ecF979KKA'

Any solution to help me with my confusion here would be most appreciated.

Thanks,

Henry

permanent link
sam detweiler (12.5k6195201) | answered Nov 18 '11, 10:48 p.m.
workitem.getCategory();

returns a HANDLE to a CATEGORY..

you need to use something like resolveAuditable() to convert that handle to the appropriate iCategory object, and then retrieve the string value via getName()

Sam

permanent link
Henry Armburg Jennings (13076) | answered Nov 19 '11, 11:44 a.m.
workitem.getCategory();

returns a HANDLE to a CATEGORY..

you need to use something like resolveAuditable() to convert that handle to the appropriate iCategory object, and then retrieve the string value via getName()

Sam


Hi Sam,

As I have said already, workitem.getCategory() does not work, in fact it does not even compile. Please see the Attribute Customization and the Javascript API here: https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript

I will try resolveAuditable() and getName() though, thank you.

Henry

permanent link
sam detweiler (12.5k6195201) | answered Nov 19 '11, 3:35 p.m.
sorry, missed the 'javascript' requirement.. haven't done any web UI extensions..

Sam

permanent link
chen fengmiao (7032932) | answered Dec 07 '11, 12:05 a.m.
How Can I convert UUID into the human readable value in javascript in RTC(3.0.1)?please help me!Thank you !

permanent link
Henry Armburg Jennings (13076) | answered Dec 07 '11, 6:05 a.m.
How Can I convert UUID into the human readable value in javascript in RTC(3.0.1)?please help me!Thank you !


I never found out how to do it, I don't think it's possible I'm afraid.

permanent link
Murad Korejo (26199) | answered Jun 28 '12, 4:29 p.m.
Hi Russell,

Above you say:
After some experimentation I got it to work by passing the custom attribute as a parameter in the process configuration source (xml) e.g.:

<valueProvider>
<script>
<parameters>

You can accesss this in the javascript e.g.:

getValue: function(attributeId, workItem, configuration) {
var type_id = configuration.getChild("parameters").getStringDefault("typeAttribute", "");
return workItem.getValue(type_id);

I am also trying to access a custom attribute of type Integer from JavaScript to perform some calculations and return the value of a different attribute.

In the process configuration source, under the <parameters> node, how should I list my params and their values??  My custom attribute has an id of "chargeRate".

Thanks very much in advance,
Murad

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.