Dojo Scripting setting value for enumeration
dojo.provide("org.example.workitems.providers.SeverityTagValueSet12");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.string");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("org.example.workitems.providers.SeverityTagValueSet12", null, {
getValue: function(attributeId, workItem, configuration) {
var tags= workItem.getValue(WorkItemAttributes.PRIORITY);
var severityOptions= [];
if (tags=="priority.literal.l02") {
severityOptions.push("severity.literal.l4"); // Unclassified
}
return severityOptions;
}
});
})();
2 answers
The script is for a value set - which would provide the available choices. It does not set any values. Only calculated values return one value that is then set.
/******************************************************************************* * Licensed Materials - Property of IBM * (c) Copyright IBM Corporation 2011. All Rights Reserved. * * Note to U.S. Government Users Restricted Rights: * Use, duplication or disclosure restricted by GSA ADP Schedule * Contract with IBM Corp. *******************************************************************************/ dojo.provide("com.example.ValueProvider"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); (function() { var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes; dojo.declare("com.example.ValueProvider", null, { getValue: function(attribute, workItem, configuration) { var prio = workItem.getValue(WorkItemAttributes.PRIORITY); if (prio == "priority.literal.l02") { return "severity.literal.l4"; // Unclassified } return workItem.getValue(attribute); } }); })();