TeamOperationCanceledExeption in Participant when a Java Script Conditions executes
Is there a way to catch the TeamOperationCanceledException and trigger a retry of the WorkItemSave3 operation?
Details of where the exception is coming from is as follows:
I am running RTC 6.0.3 server in a project that only utilizes the web interface.
There are java scripts in this environment along with a Save Advisor and a Save Participant extension.
The Participant code is extending AbstractService, implements IOperationParticipant and retrieves information from another work item and populates fields in the current work item that are read-only on the display so the user can't update these fields but the user has privileges to update said fields. The save operation extension point is defined in the plugin project.
There are two fields that are not touched by the Participant, one is an enumeration field with possible values of "YES", "NO", and "UNASSIGNED".
The second is a Large HTML field.
There is a Conditions Java Script in the Attribute Customization that Flags the HTML field as required when the enumeration field has a value of "YES".
This script works as expected if this is the only updated to the current work item.
The problem occurs when a new work item is created and the participant code is executed in the same Save transaction as the Enumeration field in question is updated to "YES".
The error message at the top of the Web interface says:
Exception running followup action. An unhandled exception occurred during "<PARTICIPANT NAME>". 'Save Work Item' failed. Preconditions have not been met. The '<ATTRIBUTE NAME>' attribute needs to be set (work item <ID>).
In the ccm.log file:
Caused by: com.ibm.team.process.common.advice.TeamOperationCanceledException: ... <Message repeated listed above from Save to the end>
I have isolated the line that is triggering the error:
IWorkItemServer.saveWorkItem3(currentWorkItem, IWorkItemReferences, null, additionalSaveParameters)
The reference to the currentWorkItem is a WorkingCopy.
I have the saveWorkItem3 command wrapped in a try/catch and am catching the TeamOperaitonCanceledException and rethrow a TeamRepositoryException to pass it back out to the run method of the participant