It's all about the answers!

Ask a question

What is the syntax to be used to make the list type enum attributes required using conditional scripting in RTC?


rkRash 123 (11219) | asked Dec 14 '17, 6:47 a.m.

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



permanent link
Donald Nong (14.5k414) | answered Dec 19 '17, 1:20 a.m.

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).

Your answer


Register or 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.