Attribute customization in RTC
![]()
Hi everyone,
I have an boolean attribute called Reopened Flag and the plan is to put a check on this flag (basically put it to True) whenever the work item reaches a certain Status. I read about the work item attribute customization guide here:
https://jazz.net/wiki/bin/view/Main/AttributeCustomization
but I'm unable to make it happen. Here's the js that I'm using by the way:
dojo.provide("org.example.workitems.providers.Reopen");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("org.example.workitems.providers.Reopen", null, {
getValue: function(attributeId, workItem, configuration) {
{
var reopen = workItem.getValue(WorkItemAttributes.REOPENED);
var ret = "False";
var state = workItem.getValue(WorkItemAttributes.STATE);
if (state == 6){
ret="True";
}
return ret;}
});
})();
I think the problem is with how I return the value
|
Accepted answer
One other answer
![]()
Dinesh Kumar B (4.1k●4●13)
| answered Feb 25 '14, 8:26 a.m.
JAZZ DEVELOPER edited Feb 25 '14, 8:34 a.m.
your return statement is fine...
workItem.getValue on STATE returns a string value : ![]() so, use a string format for comparison... modify if (state == 6) to if (state == "6") i checked with a similar code and it works.. hope it helps. Comments
Yes that took care of it.
I edited it a bit and now it looks like:
getValue: function(attributeId, workItem, configuration) {
var reopen = workItem.getValue(WorkItemAttributes.REOPENED);
var state = workItem.getValue(WorkItemAttributes.STATE);
if (reopen == "True"){
return "True";
} else {
if (state == "6"){
return "True";
}
}
}
Now I'd like for it to keep the check mark even if I move the status to anything other than reopened though, but when I do that the check mark is gone. |
Comments
Reopened Flag is the name/label as it appears on the work item, and Reopened is the name of the attribute.