What is the syntax to be used to make the list type enum attributes required using conditional scripting in RTC?
Hi All,
I am trying to write conditional scripting to make the list type custom enum attribute required and not allowing to save in Attribute customization section..
I have applied the Required Attribute preconditions according to role ,, the script works fine for notmal attributes like priority but when i built this for custom list type enum attribute m not able to succeed.
dojo.provide("com.example.Condition1");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.example.Condition1", null, {
matches: function(workItem, configuration) {
var WItype = workItem.getLabel(WorkItemAttributes.TYPE);
var brand = workItem.getLabel("Brands");
var PA = workItem.getLabel(WorkItemAttributes.PROJECT_AREA);
if( WItype == "Feature" )
{
if( brand == null)
{
return 1;
}
else
{return 0;
}
}
}
});
})();
In the above script brands is and list type enum .. But i failed to make the script to behave normally ?
Is there any issue with my above query? or any syntax ti be used specially for enum list type attribute.
Thank you
One answer
You can make an Enumeration List attribute mandatory the same way as other attributes. You need the "Required Attributes For Condition" precondition. Don't worry about the logic in your script - for testing purpose, you should just use a script as simple as "return true" (the example script is exactly what you need).