It's all about the answers!

Ask a question

TeamOperationCanceledExeption in Participant when a Java Script Conditions executes

Ryan McFadden (191318) | asked Nov 06 '18, 8:17 p.m.

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: ... <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

2 answers

permanent link
Ralph Schoon (63.3k33646) | answered Nov 07 '18, 2:42 a.m.

 For all I know, the error you see is thrown because another participant prevents the save due to a required attribute. There is no way you can fix this. The only way to avoid the error is by providing the value(s) required attribute(s).

permanent link
Ryan McFadden (191318) | answered Dec 04 '18, 8:06 p.m.

This seems like errant behavior. 

The work-around that I settled on was moving the conditions java script out of the New state.  Once the participant was able to complete execution for a new work item, the Conditions script was not trying to execute while the work item was in the initialize state. 

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.