It's all about the answers!

Ask a question

how can I use Script-based calculated values to reset timestamp column in empty?


Charles Lin (111) | asked Jun 30 '14, 7:46 a.m.
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 commented Jun 30 '14, 8:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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 commented Jun 30 '14, 8:08 a.m.

 If the attribute is showing empty, the content you get with a script is null


I already tried return "" ,null and undefined  but the value still unchange !


Donald Nong commented 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.

Be the first one to answer this question!


Register or to post your answer.