It's all about the answers!

Ask a question

How to fix workItems with creationDate main field set to none, but with a correct creationDate in the History?


Jose Omar Oseguera Chijate (346) | asked Nov 30 '16, 12:50 p.m.
Right now I'm having trouble with some work items. The Creation Date field that appears in the main part of the work item is displaying a "None" value, meanwhile inside the History the first log shows the Creation Date in which the work item was created.

2 answers



permanent link
Sudipto Sarkar (63536) | answered Nov 30 '16, 1:58 p.m.
 one way is to set the creation date as system property date so that both the  dates I.e. on the work item and history are in sync. 

Comments
Jose Omar Oseguera Chijate commented Dec 12 '16, 1:48 p.m.

Hi, sorry but i dont know how to set the creation date as a system property on RTC. Can you please explain a little further or direct me to a link in where i can learn how to do this?


permanent link
Sudipto Sarkar (63536) | answered Dec 13 '16, 3:47 a.m.
            DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
            Date date = new Date();
            IWorkItem wi=client.findWorkItemById(workItemId, IWorkItem.FULL_PROFILE, monitor);
               IWorkItemWorkingCopyManager manager= client.getWorkItemWorkingCopyManager();
               manager.connect(handle, IWorkItem.FULL_PROFILE, monitor);
                wc = manager.getWorkingCopy(handle);
            wi.setCreationDate(new Timestamp(date.getTime()));
            wc.save(null);

This should update the workitem's creation date as system date.

Comments
Jose Omar Oseguera Chijate commented Dec 13 '16, 10:11 a.m.

Thanks i will try it and see if it fixes my problem.

Your answer


Register or to post your answer.