JODO script to set current time for a timestamp attribute
I want to set the current time for a attribute based on the value change of another attribute,
Can some one please help me with an example script how to do this.
Change of the estimate attribute, I want to set the due date attribute to current system date lets say as an example.
Please help me on this.
Accepted answer
https://jazz.net/forum/questions/65781/setting-default-values-for-timestamp-custom-attribute
https://jazz.net/forum/questions/113192/work-item-attribute-customization-how-to-set-current-date-in-timestamp-attribute
https://jazz.net/forum/questions/77931/attribute-configuration-calculated-timestamp-being-set-unexpectantly
Comments
dojo.provide("example.calculated.TimeStampChange");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date.stamp");
(function() {
dojo.declare("example.calculated.TimeStampChange", null, {
getValue: function(attribute, workitem, configuration) {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var currentDate= new Date();
var datum = currentDate.getDate();
var mjesec = currentDate.getMonth() + 1;
var godina = currentDate.getFullYear();
var currentDateString= dojo.date.stamp.toISOString(currentDate, {milliseconds:true, zulu:true});
var systemDate = dojo.date.stamp.toISOString(new Date(godina, mjesec, datum), {milliseconds:true, zulu:true});
var result = "0";
var defectStatus = workitem.getLabel(WorkItemAttributes.STATE);
if(defectStatus == "Resolve"){
result = currentDateString
}
return result;
}
after running this script, it the defect status is of state resolve, my custom timestamp attribute need to be set wil current time, which is not happening
Also the result attribute is giving some old date, is it possible to set the date as NONEĀ instead of some old date
after running this script, if the defect is of state resolve, my custom timestamp attribute need to set with current time, which is not happening
Also is the state is of some other instead of Resolve , the timestamp attribute is set with some old date, is it possible to set the date as NONEĀ instead of some old date