how can I use Script-based calculated values to reset timestamp column in empty?
![]()
in the beginning , the column has value (ex: 2014/6/30 PM 7:31:25)
when state == s4 , I want to reset timestamp column in empty? But it dosen't work
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("org.example.workitems.providers.CompletedDate", null, {
getValue: function(attributeId, workItem, configuration) {
var state= workItem.getValue(WorkItemAttributes.STATE);
if (state == "workflow.jobassign.state.s5") {
var date = new Date();
var sysdate= dojo.date.stamp.toISOString(date, {milliseconds:true, zulu:true});
return sysdate;
}else if (state == "workflow.jobassign.state.s4") {
console.log("state == s4");
return null; //want to clear the column
}
return null;
}
});
})();
|
Comments
Can you describe a little bit better, what you try to do?
You can try to return something other than null e.g. "". Not sure if that works with timestamp attributes.
If the attribute is showing empty, what is the content you get with a script? Can you use that and return it?
If the attribute is showing empty, the content you get with a script is null
Null is the right choice. I have no problems with setting a Timestamp field to "none". I suspect your code may fail in the middle, or may not even triggered. I suggest you start with the simplest function with the code "return null;" only.