It's all about the answers!

Ask a question

Attribute Customization - Calculated Value - Comment Timestamp

Pablo Vera (11) | asked Feb 02 '18, 2:51 p.m.
edited Feb 03 '18, 4:07 a.m. by Ralph Schoon (55.8k23642)
I need to have a custom attribute saving the timestamp when a comment is added.
I have a script that saves the timestamp, but it updates every time the Work Item is saved.
    var WorkItemAttributes =;
    var fromISOString =;
    dojo.declare("com.saveCommentDate", null, {
        getValue: function(attribute, workItem, configuration) {
            var now = new Date();
            return, {milliseconds:true, zulu:true});

Anyone who knows how can I check if the update comes from a new comment?
Or, how to execute the script only on comment updates?

Accepted answer

permanent link
Ralph Schoon (55.8k23642) | answered Feb 03 '18, 4:06 a.m.
edited Feb 03 '18, 4:36 a.m.

This is not going to work. Read to understand when and how often the scripts are called - it is more often than you think. Also play close attention to what attribute types are supported and which are not (the ones NOT mentioned as supported).

Also consider

I don't think what you try is acievable with attribute customization. A work item save follow up action could do this however.

Ralph Schoon selected this answer as the correct answer

Pablo Vera commented Feb 14 '18, 9:25 a.m.

Thanks for the answer. I was thinking about identifying if a new comment was added or not, and save the timestamp if there is a new comment...

Ralph Schoon commented Feb 14 '18, 9:43 a.m. | edited Feb 14 '18, 9:43 a.m.

As far as I can tell, there IS NO way for you to detect comments in java script attribute customization. Even if, there is likely no timestamp. the API does not support complex attribute types. What is supported is listed in the link.

I have explained the same stuff over and over again. Please read the links I provided. Good luck.

Your answer

Register or to post your answer.