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!
|
One answer
![]()
Ralph Schoon (60.5k●3●36●43)
| 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 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"/>
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
Gil
you use its ID string to get the value..
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.
|