Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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; 
             }
                      
           
           
     }     
    }); 
}) ();

0 votes

Comments

Hello Amit,
not sure what is the question / expectation here.

Thanks.
Eric.

Thanks everyone for your suggestions.


The issue has been solved.
 My script was not taking the state value in the variable and now field is fetching date properly.
 



One answer

Permanent link
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.

 

1 vote

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 152

Question asked: Feb 09 '13, 6:24 a.m.

Question was seen: 6,007 times

Last updated: Apr 02 '13, 4:32 a.m.

Confirmation Cancel Confirm