Calculated value to work only in particular state
I have the below script that successfully updated Planned for iteration. Now for any other state the iteration is not allowed for manual update to any other value. What is wrong? How can I tell the script to leave the Planned for for regular manual updates in all other states?
dojo.provide("ibm.custom.script.IterationByStatus");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("ibm.custom.script.IterationByStatus", null, {
getValue: function(attribute, workItem, configuration) {
/* console.log(workItem.getValue(WorkItemAttributes.STATE)); */
var state= workItem.getValue(WorkItemAttributes.STATE);
console.log(typeof(state))
if(state === "com.ibm.team.workitem.taskWorkflow.state.s4")
{ return "_kCgEYQ-_EeWZJcN1wzIszA"; }
}
});
})();
dojo.provide("ibm.custom.script.IterationByStatus");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("ibm.custom.script.IterationByStatus", null, {
getValue: function(attribute, workItem, configuration) {
/* console.log(workItem.getValue(WorkItemAttributes.STATE)); */
var state= workItem.getValue(WorkItemAttributes.STATE);
console.log(typeof(state))
if(state === "com.ibm.team.workitem.taskWorkflow.state.s4")
{ return "_kCgEYQ-_EeWZJcN1wzIszA"; }
}
});
})();