WorkItemAttributes is not defined
Hi ,
I am trying the work item customization in RTC and I want to Retrieve value of FILED AGAINST using (workItem.getvalue(WorkItemAttributes.FILED_AGAINST))
here is my script
dojo.declare("com.example.fieldDataFetch", null, {
getValue: function(attribute, workItem, configuration) {
var field = workItem.getValue(WorkItemAttributes.FILED_AGAINST);
if(field){
return field.toString();
}
else{
return "";
}
}
and error showing
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "WorkItemAttributes" is not defined. (fielddatafetch.js#9)
can anyone tell me how to resolve this
Accepted answer
See https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_Example
You forgot to require com.ibm.team.workitem.api.common.WorkItemAttributes and to define the variable.
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");(function() { var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
Comments
thanks to you Ralph sir
It working now but output showing like :: _OACFEHbkEemS96vCfwTFog format
please tell me how to resolve this
Carefully read https://jazz.net/wiki/bin/view/Main/AttributeCustomization. Especially the supported data types. Filed against is not really supported. However, for every attribute you can getValue() or getLabel(). getValue returns the value - in this case it is the UUID of the category. getLabel() gets a display label, that would be the category name in this case.