It's all about the answers!

Ask a question

Time stamp overwritting when i save the WI


Vijayveer Reddy (17625) | asked Sep 07 '16, 5:50 a.m.
edited Sep 07 '16, 6:42 a.m.
Hi,

I request for your help or suggestion for the issue that i have seen in the RTC Perl scripts.

Action = Fixed
State = Fixed

I have a script which capture the Time stamp when the action "Fixed" is performed in Defect WI.. 
My question is..

Now the WI is in the "Fixed" state.

In the "Fixed" State i have changed some attribute value (Example: Team area or Owned by) and click on save  then the Time stamp is overwriting which should not happen. 

Please suggest me..

Kind Regards,
Vijay


 

Comments
Dinesh Kumar B commented Sep 07 '16, 6:28 a.m.
JAZZ DEVELOPER

are you watching for the action "Fixed" or the state.. may be if you share the sample script, it would help assess if something is missing or it would behave the way it does.. thanks


Vijayveer Reddy commented Sep 07 '16, 6:59 a.m.

Hi Dinesh,

Thanks for the Response.

Please review the script

Kind Regards,
Vijay


Vijayveer Reddy commented Sep 07 '16, 7:04 a.m.

Hi Dinesh,

Thanks for the Response.

Please review the script

Kind Regards,
Vijay

One answer



permanent link
Vijayveer Reddy (17625) | answered Sep 07 '16, 6:53 a.m.
Hi Dinesh,

Thanks for your response..!

Please review the script..  your help will be appreciated.


dojo.provide("com.example.defectresolutiondateCalculationValueProvider");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date.stamp");

// --------------------------------------------------------------------------------
// the date to the current timestamp.
// --------------------------------------------------------------------------------

(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

dojo.declare("com.example.defectresolutiondateCalculationValueProvider", null, {
    getValue: function(attributeId, workItem, configuration) {
      
        // Log messages go to:  Eclipse client: client/eclipse/workspace/.metadata/.log
        console.log("com.example.dateCalculationValueProvider - Entry");
      
       
        // Get the current timestamp, and convert it to an ISO-8601 string

       var ModifiedDate = new Date();
console.log("Modified Date = " +ModifiedDate);
        var ModifiedDateString= dojo.date.stamp.toISOString(ModifiedDate, {milliseconds:true, zulu:true});
console.log("Modified Date String = " +ModifiedDateString);
 
        var ReviewStatus = workItem.getValue(WorkItemAttributes.STATE);
        console.log("com.example.dateCalculationValueProvider:  ReviewStatus: '" + ReviewStatus + "'");
       


        // If the state is Fixed
        if ( ReviewStatus == "NewDefectWorkflow.state.s2" )
        {

            return ModifiedDateString;
        }
        else
        {
       
        //var retestDate = dojo.date.stamp.toISOString(workItem.getValue("retesting_date"));

//console.log("current constraint date is "+retestDate);

           console.log("set old date back");
           return workItem.getValue(attributeId);
          
         }
        
        console.log("com.example.dateCalculationValueProvider - Exit:  Review date returned is '" + ModifiedDateString + "'")
      
       
    }
});
})();

Comments
sam detweiler commented Sep 07 '16, 7:26 a.m.

the problem is that you cannot tell that this state is JUST being set or has been for a long time.. your code is causing the date change

        if ( ReviewStatus == "NewDefectWorkflow.state.s2" )
        {

            return ModifiedDateString;
        }

Your answer


Register or to post your answer.