It's all about the answers!

Ask a question

Get by code a deliverable type attribute


Gil Br (1014) | asked Nov 19 '14, 10:54 a.m.
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!

One answer



permanent link
Ralph Schoon (63.7k33648) | answered Nov 21 '14, 6:43 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Nov 21 '14, 6:44 a.m.
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.  

Comments
Ralph Schoon commented Nov 21 '14, 6:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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


Gil Br commented Nov 23 '14, 7:42 a.m.

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


sam detweiler commented Nov 23 '14, 8:12 a.m.

you use its ID string to get the value.. 

attributeId="targetrelease"


Ralph Schoon commented Nov 24 '14, 2:49 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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 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.