Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Attribute Customization - Calculated Value - Comment Timestamp

Hi
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.
dojo.provide("com.saveCommentDate");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function(){
    var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
    var fromISOString = dojo.date.stamp.fromISOString;
    dojo.declare("com.saveCommentDate", null, {
        getValue: function(attribute, workItem, configuration) {
            var now = new Date();
            return dojo.date.stamp.toISOString(now, {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?
 Thanks!

0 votes


Accepted answer

Permanent link

This is not going to work. Read https://jazz.net/wiki/bin/view/Main/AttributeCustomization 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

0 votes

Comments

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...

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Feb 02 '18, 2:51 p.m.

Question was seen: 1,782 times

Last updated: Feb 14 '18, 9:43 a.m.

Confirmation Cancel Confirm