Assign actual start date value systematically
Hi All,
I have created "Actual Start date" attribute of Type string for WI. The moment i move from 'New' state to 'In progress' state 'Actual Start date' field should take date systematically.
i have written a script which takes date along with time but i want only Date to be displayed.
Also when 'In Progress' State i have make any further changes in WI and save then the field takes current time.
Following is the script which i have written
dojo.provide("currentInProgressDate");
dojo.require("dojo.date.stamp");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("currentInProgressDate", null, {
getValue: function(attribute, workItem, configuration) {
var now = new Date();
var stat = workItem.getValue(WorkItemAttributes.STATE);
if(stat === "com.ibm.team.workitem.taskWorkflow.state.s2")
{
return now;
}
}
});
}) ();
One answer
Hi, As Eric, I can only guess what the question is - or if this is a statement.
Please note, timestamp attributes are currently date and time of date. See https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=239758 for an enhancement.
If you are using a string attribute, you could probably look into https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript and how timestamps are handled. You could try to print only the date there.
Please be aware, that Javascript has issues with detecting state changes. You need to make the script dependent only on the state attribute, this way the script is only triggered if the state is set. If you have more dependencies, you can't tell anymore. I would personally rather use a participant (see https://jazz.net/library/article/1000) because I can actually distinguish the state transitions there. See https://jazz.net/library/article/1093 lab 5 for more hints on Javascript.
Please note, timestamp attributes are currently date and time of date. See https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=239758 for an enhancement.
If you are using a string attribute, you could probably look into https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript and how timestamps are handled. You could try to print only the date there.
Please be aware, that Javascript has issues with detecting state changes. You need to make the script dependent only on the state attribute, this way the script is only triggered if the state is set. If you have more dependencies, you can't tell anymore. I would personally rather use a participant (see https://jazz.net/library/article/1000) because I can actually distinguish the state transitions there. See https://jazz.net/library/article/1093 lab 5 for more hints on Javascript.
Comments
Eric Jodet
JAZZ DEVELOPER Feb 11 '13, 12:46 a.m.Hello Amit,
not sure what is the question / expectation here.
Thanks.
Eric.
Amit Girme
Feb 11 '13, 6:42 p.m.Thanks everyone for your suggestions.