It's all about the answers!

Ask a question

EWM 7.0 - How to have calculated value script clear a timestamp attribute?

Kevin Johnson (116) | asked Aug 19 '21, 1:01 a.m.

The below is the behavior we see for the web client. We are not using Eclipse client.

We have a calculated value script that inserts today's date into an attribute of type Timestamp if the user has checked the box on a Boolean attribute. When the user sets the checkbox (true), the calculated script correctly inserts today's date into the Date attribute. Before saving the work item if the user unchecks the box then, as we want, the Date attribute is cleared.

This works fine. Once. If the user again checks the box (before clicking Save) then we can see that the calculated value script is not even called again (from console.log() ) . So the attribute does not get set to today's date.

It seems the problem is with the return value from the calculate value script if the Boolean is unchecked. The above scenario plays out when we return null. We've tried returning null, "", 0, and even "Undefined."

If we return null then that seems to break it and the script won't run again.

If we return "" or 0 then the date attribute displays Jan 1, 1970 -  which would be expected for 0.

"Undefined" gives us "Unsupported value - Undefined" - Yes, we are grasping at straws now.

How can we clear (show blank) a Timestamp attribute in a calculated value script?



Accepted answer

permanent link
Ralph Schoon (63.3k33646) | answered Aug 19 '21, 9:44 a.m.

 Hi Kevin,

I used this script to test. It was configured against the due date attribute. You enter something in the summary and the script triggers. You can debug this in the web UI. Chrome works best.

 * 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(""); // We need the date class from Dojo to compare two dates dojo.require(""); // We need the stamp class to work with ISO date strings dojo.require("");

(function() { var WorkItemAttributes=; dojo.declare("com.example.ValueProvider", null, {

    getValue: function(attribute, workItem, configuration) {

        var val = workItem.getValue(attribute)          
        var old=;
        var date = new Date()   
        var dateString =, {milliseconds:true, zulu:true});
        var aSummary = workItem.getValue(WorkItemAttributes.SUMMARY);
            return dateString;
            return null;
            return "";
        return workItem.getValue(attribute);


I can confirm your observation that the script is not called after returning null, which actually clears the due date, but the script is no longer called afterwards,

I would suggest to open a case with support.

I used 7.0.2 for the test.

Ralph Schoon selected this answer as the correct answer

Ralph Schoon commented Aug 19 '21, 10:02 a.m.

I tried the example in the Eclipse client, but it appears to be not working. Not sure if I did something wrong. 

Kevin Johnson commented Aug 19 '21, 12:00 p.m.
Hello Ralph,

Thank you for your time and help. I opened a case with IBM. I see the same behavior on 7.0.0 and 7.0.1 and you see it on 7.0.2.


Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.