It's all about the answers!

Ask a question

Assigning current Time Stamp upon closure of defects


0
1
Rajesh Avanthi (10815137173) | asked Nov 23 '12, 7:17 a.m.
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

3 answers



permanent link
Moti Wertheimer (18913628) | answered Jul 22 '13, 3:47 a.m.
JAZZ DEVELOPER
Hi Joan,
Yes, I have create the attribute as a timestamp as you realized.
Need to see what's wrong in your configuration/script

Comments
Joan Mpofu commented Jul 24 '13, 7:43 a.m.

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


permanent link
Moti Wertheimer (18913628) | answered Dec 26 '12, 3:15 a.m.
JAZZ DEVELOPER
edited Dec 26 '12, 3:16 a.m.
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;                
        }
    });
})();
-------------------


Comments
Joan Mpofu commented Jul 18 '13, 12:30 p.m.

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
Brian Fleming (1.6k11928) | answered Nov 23 '12, 11:06 a.m.
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

Comments
Ralph Schoon commented Nov 23 '12, 11:10 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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 .


Brian Fleming commented Nov 23 '12, 12:33 p.m.

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;


Ralph Schoon commented Nov 24 '12, 5:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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


Don Yang commented Sep 10 '14, 6:17 p.m.

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

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.