please help! cannot add/modify time sheets - ITimeSheetEntry
![]()
I'm trying to add and/or modify ITimeSheetEntry objects in RTC 3.0.1. I've tried a variety of different ways to create the references/links, but, it just doesn't seem to take. Using the code below:
I get the following exception:
One strange item of note is that if I create time sheet entries via the Eclipse client and query the references, I notice that they all have the same ItemId, yet, the createTimeSheetEntry line above creates a unique item id. Not sure if thats what the underlying problem is or not. Any help on this matter would be greatly appreciated, especially since the post here: https://jazz.net/forums/viewtopic.php?t=18764 was never replied to :-( |
4 answers
![]()
Just for anyone else that's ever trying to do this ... I got an answer back from someone in RTC -- turns out I was missing one, very much undocumented, piece of code:
//add the new entry copyReferences.add(workTimeEndPoint, timesheetRef); After I got things working with the above line of code, and further tested, I realized that RTC really requires you to additionally still maintain the total timeSpent field even when you update/add ITimeSheetEntry items. So, whenever you make changes, you'll want to re-calculate the timeSpent as well. Hopefully that helps someone else out there. Enjoy! I'm trying to add and/or modify ITimeSheetEntry objects in RTC 3.0.1. I've tried a variety of different ways to create the references/links, but, it just doesn't seem to take. Using the code below: |
![]()
Hi.
I'm trying to do the same thing, but with the Service API, using an OperationParticipant. With the code bellow I don't get any errors and saves the workItem just fine, but it does not create a new TimeSheetEntry. Does anyone have an idea? ITimeSheetEntry newEntry = workItemService.createTimeSheetEntry(wiCopy.getProjectArea()); newEntry.setHoursSpent(hourInterval); newEntry.setStartDate(alocationDate); IWorkItemReferences references = workItemService.resolveWorkItemReferences(wiCopy, null); IItemReference timesheetRef = IReferenceFactory.INSTANCE.createReferenceToItem(newEntry); references.add(WorkItemEndPoints.WORK_TIME, timesheetRef); workItemService.saveWorkItem2(wiCopy, references, null); Thanks in advance. Luana |
![]()
Looks like you are missing the same line of code that I was missing originally, the stuff around wc.getDependentItems().add(...). Not sure how to do that on the server side though.
Hi. |