It's all about the answers!

Ask a question

How to get previous values (state) of an ITimeSheetEntry?

Eduardo Bello (4401922) | asked Jul 28 '11, 9:52 a.m.

I'm developing an IOperationParticipant that needs to detect the exact change on time tracking.

In order to get previous values of an WorkItem attribute inside an IOperationParticipant, I simply use:

IWorkItem oldWorkItem = (IWorkItem) saveParameter.getOldState();

But as far as I know, ITimeSheetEntry is linked to a WorkItem using endpoint WorkItemEndPoints.WORK_TIME. So my question is: How to get previous states of those linked objects, or what is the extension point to listen to ITimeSheetEntry changes?

I tried this, but obviously didn't work, because it gets the current values of the links:

List<ITimeSheetEntry> listTimeChildren = new ArrayList<ITimeSheetEntry>();

IWorkItemServer service = getService(IWorkItemServer.class);
IWorkItemReferences workItemReferences = service.resolveWorkItemReferences(oldWorkItem , null);
List<IReference> listReferences = workItemReferences.getReferences(WorkItemEndPoints.WORK_TIME);
for (IReference reference : listReferences) {
if (reference.isItemReference()) {
referencedItem = ((IItemReference) reference).getReferencedItem();
if (referencedItem instanceof ITimeSheetEntryHandle) {
timeChild = (ITimeSheetEntry) repositoryItemService.fetchItem(referencedItem, null);


For new or deleted ITimeSheetEntry, I can use getCreatedReferences and getDeletedReferences. But if the user change a value of an existing entry, I'm unable to find out what entry has been changed.

Rubin Zheng commented Sep 01 '13, 3:17 a.m.

Any idea?  I have the same question. 

3 answers

permanent link
Rubin Zheng (1698) | answered Sep 03 '13, 9:30 a.m.
 I worked out a workaround that traverse all  ITimeSheetEntry.modified() and get the TimeSheetEntry which modified in last a few seconds in the followup action.  

permanent link
Nate Decker (37814561) | answered Apr 02 '15, 9:47 a.m.
edited Apr 02 '15, 9:49 a.m.

This is an old question, but for anyone that is still wondering, I have a more direct way than looking at the recently modified timesheets.

IWorkItemServer service = getService(IWorkItemServer.class);

ArrayList<IReference> newLinks = new ArrayList<IReference>();

ArrayList<IReference> oldLinks = new ArrayList<IReference>();

IWorkItemReferences newReferences = saveParameter.getNewReferences();


if(saveParameter.getOldState() != null) {

     IWorkItem previousWI = (IWorkItem) (saveParameter.getOldState());

     IWorkItemReferences oldReferences = service.resolveWorkItemReferences((IWorkItemHandle) previousWI.getItemHandl(), monitor);



As usual, remember that if you are using the IWorkItemServer object, you'll need to add the "requiredService" node to the plugin.xml of your MANIFEST.MF file.

permanent link
Ralph Schoon (63.3k33646) | answered Apr 02 '15, 9:55 a.m.
In general for IAuditables, and ITimeSheetEntry, you can get the two possible predecessors like this:


Assuming that that history is actually preserved.

Your answer

Register or 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.