It's all about the answers!

Ask a question

EWM javascript on an enumerated list shows the required attribute but does not enforce requiredness.


Mathew Spurgeon (3195) | asked Oct 02 '20, 11:13 a.m.

I am writing an attribute customization to dynamically require fields when an enumeration list value is selected.  The script reads the enumeration and finds the value needed.  The script finds the value and the presentation is showing the required * on the desired attribute.  The problem is the enforcement of the required attribute.  If the "flag" is set from an enumeration list it does not enforce required.  If the "flag" is set from outside the list it works a designed.  Am I doing something wrong or is this a known issue.  


Tested on 7.0.1, 6.0.6.1 EWM

dojo.provide("org.example.workitems.providers.newscript");

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.newscript", null, {

matches: function(workItem, configuration) {
var checklist= workItem.getValue('what_platforms');
var flag;
for (var i0; i < checklist.length; i++) {
console.log(checklist[i].id)
if (checklist[i].id === "OS.literal.l2") {
flag = 1; // Setting this value when the loop finds the item in the list
}
}
var flagger = 1; // Dummy variable to try to debug.
// If the variable is flagger the Operational Behavior works an normal
// If the variable is flag (desired approach) web page shows required
// but the enforcement does not happen
//if (flagger) {
if (flag) {
console.log("Flag = "+ flag)
return true; // "Because the enum value was found";
}
return false; // "Because the enum value was NOT found";
}
});
})();

Be the first one to answer this question!


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.