Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Get by code a deliverable type attribute

Hi,
I'm new to dojox and RTC code.
I have an attribute 'Target Release' of type deliverable which is an enumeration.
Having the ID of the attribute 'com.ibm.team.workitem.attribute.version' I tried the following code (As part of Script Based Calculated Value code) :

   dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

   getValue: function(attribute, workItem, configuration) {
         var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
         var TargetRelease =  workItem.getValue("com.ibm.team.workitem.attribute.version");
         var result = new dojox.string.Builder();
         result.append(TargetRelease);
         return result.toString();
 }

The above yields null,  I've also tried:
var workItem.getLabel(WorkItemAttributes.version);
I understand this is a special type attribute (as I did managed to successfully get the built-in attributes of work items, like WorkItemAttributes.SEVERITY and also simple type ones (such as numbers))

Is there anyone who succeeded getting a deliverable typed attribute value using the Calculated Values .js script?

Thanks in advance!

0 votes



One answer

Permanent link
Have you looked at https://jazz.net/library/article/1093 Lab 5 for examples?

If the ID (from https://jazz.net/wiki/bin/view/Main/AttributeCustomization ) -I think it is WorkItemAttributes.FOUND_IN for this attribute - is used, you should get a value back.

Please note, you need to use getLabel() to get a string you can actually print. You can not access anything from the object you get with getValue(). Please read the information about the API given in the links above.  

0 votes

Comments

The AttributeValueSpy in https://jazz.net/library/article/1093 prints all attributes, I was able to access into the work item description.

Hi Ralph,

The attribute I'm looking for is user defined and not included in the predefined attributes such as FOUND_IN.

Here's the definition:

 <customattribute <="" p=""> 

id="targetrelease" name="Target Release" type="deliverable"/>
 
 <presentation <="" p=""> 

attributeId="targetrelease" description="Target Release" id="Target Release" kind="com.ibm.team.workitem.kind.internal.deliverable" label="Target Release"/>

It's an enumeration attribute with few user defined values.

I need a way to get its value using Script Based Calculated Value code


Thanks in advance,

Gil

you use its ID string to get the value.. 

attributeId="targetrelease"

Right, if it is a custom attribute the only difference is the ID you use. The wiki and the workshop are still the best source of information if you want to get started.

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,940

Question asked: Nov 19 '14, 10:54 a.m.

Question was seen: 3,753 times

Last updated: Nov 24 '14, 2:49 a.m.

Confirmation Cancel Confirm