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 |
3 answers
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.
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,
|
Moti Wertheimer (189●1●36●28)
| 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
|
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
|
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.