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
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 30 '14, 8:00 a.m.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?
Charles Lin
Jun 30 '14, 8:08 a.m.If the attribute is showing empty, the content you get with a script is null
Donald Nong
Jul 04 '14, 12:06 a.m.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.