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

Assigning current Time Stamp upon closure of defects

Hi

I'm currently working with RQM 3.0
A new  field "Closing_Date" in defects is added to capture closing date of the defect.
It would be a  mandatory field when user tries to move defect to "CLOSED" status.
But, while doing so it should pick up the current time stamp.

I heard that this can be achieve with a Dojo script?
Any guidance on this please.....

Thanks

1

0 votes



3 answers

Permanent link
I assume you are using RTC as the defect provider.  RTC defects already have a "resolution date" attribute that does this.  If you've looked into this field already could you explain why it is insufficient?

In general the answer to your question is to edit the RTC project area process configuration via the Eclipse client:
1. Create a script based calculated value
2. Create a new timestamp attribute for the defect work item
3. Select the script created in step 1 in the "Calculated Value" dropdown of the new attribute
4. Configure the new attribute to have a dependency on the "Status" attribute. 
5. Add a read only presentation for your new attribute to the defect editor

This post contains a good sample script that manipulates dates.  Your script will need to be modified, for example to take the state of the workitem into account.

https://jazz.net/forum/questions/83120/how-to-show-the-difference-between-current-date-and-due-date-through-script-based-calculated-value

1 vote

Comments

Brian, as far as I can tell, there is no easy way to detect the state change using scripts. If you have an idea, please share it. So far you can only read the current state .

I think we can do this without detecting the state change in the script.  If the new attribute is configured to have a dependency on "Status", the script will re-execute every time there is a state change.  Then, you can add an if switch in the script to only return a value when the workitem is resolved, like below.  A good exercise for the reader is to figure out how to clear the value if the workitem gets re-opened.

   var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
   var currentDate= new Date();  
   if (workItem.getValue(WorkItemAttributes.STATE)=="3") {
                 return currentDate.getTime().toString();
   }
   return 0;

Hi Brian, OK, that might work if the State attribute is the only dependency. Thanks for the hint.

Brian,

I tried the similar procedures and scripts as suggested and it does not work. When state changed to resolved, the custom attribute remains as None. I posted the question here:

https://jazz.net/forum/questions/162999/assigning-current-time-stamp-when-defect-is-resolved

Do you know what could be wrong? Thanks


Permanent link
Just to have the complete script that works for me for "Reopen Date":
And to follow the same behavior like "resolution date" I make the field read only on the presentation.

-----------------
dojo.provide("com.example.ValueProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
    var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
   
    dojo.declare("com.example.ValueProvider", null, {
        getValue: function(attribute, workItem, configuration) {
           
            var currentDate= new Date(); 
            if (workItem.getValue(WorkItemAttributes.STATE)=="6") {
                 return currentDate.getTime().toString();
            }
            return 0;                
        }
    });
})();
-------------------

0 votes

Comments

Hi Moti Wertheimer
Did you create the new Attribute i.e. "Reopen Date" as a timestamp type?
I am trying to use your script in the same way but am not getting the desired results
Thanks


Permanent link
Hi Joan,
Yes, I have create the attribute as a timestamp as you realized.
Need to see what's wrong in your configuration/script

0 votes

Comments

Hi Moti
I had not enabled the Process attachment scripts property in RTC admin.
Its working fine now. Thanks

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
× 10,930
× 7,489

Question asked: Nov 23 '12, 7:17 a.m.

Question was seen: 7,731 times

Last updated: Sep 10 '14, 6:17 p.m.

Confirmation Cancel Confirm