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

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

0 votes


Accepted answer

Permanent link

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;

Aditya Shankar selected this answer as the correct answer

0 votes

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.

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

Question asked: May 24 '19, 9:39 a.m.

Question was seen: 682 times

Last updated: May 27 '19, 8:19 a.m.

Confirmation Cancel Confirm