Assign actual start date value systematically
Amit Girme (11●3●20●27)
| asked Feb 09 '13, 6:24 a.m.
edited Apr 02 '13, 4:32 a.m. by Ralph Schoon (63.5k●3●36●46)
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
Ralph Schoon (63.5k●3●36●46)
| answered Feb 11 '13, 2:57 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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. |
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.
Comments
Hello Amit,
not sure what is the question / expectation here.
Thanks.
Eric.
Thanks everyone for your suggestions.