It's all about the answers!

Ask a question

Using Custom Operation Advisor(custom precondition) to check if workitem's time tracking could be saved.


Aliaksei Gizheuski (23610) | asked Feb 12 '13, 8:48 a.m.
edited Feb 12 '13, 8:50 a.m.
Imagine following case for RTC 3.0.1:

A user enters his progress in hours for a particular work item in the time tracking tab.
I should prohibit him to save this data if he enters it in some invalid time periods (i.e. before 01.01.2013).

The idea was to develop a plugin that would implement custom precondition for the save operation. This plugin could have asked an external service for invalid time periods.

The problem: I don't know how could my plugin get the data entered by a user in the time tracking tab.

Accepted answer


permanent link
Ralph Schoon (63.5k33646) | answered Feb 12 '13, 11:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I searched the API for ITimeSheetEntry and figured it is managed as a reference. See the client code below. So you would look into the new references of the new state.

	
		ITimeSheetEntry entry= workItemClient.createTimeSheetEntry(fgProjectArea);
		entry.setStartDate(now);
		entry.setTimeSpent(twoHours);
		entry.setTimeCodeId(timeCodeId);
		entry.setTimeCode(timeCodeLabel);
		entry.setWorkType(workType);
		
		references.add(WorkItemEndPoints.WORK_TIME, IReferenceFactory.INSTANCE.createReferenceToItem(entry));
		workingCopy.getDependentItems().add(entry);

Aliaksei Gizheuski selected this answer as the correct answer

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.