RTC Server Extension to save work item
I tried using method in follow-up actions :
fWorkItemServer = getService(IWorkItemServer.class);
IWorkItem workingCopy = (IWorkItem) fWorkItemServer
.getAuditableCommon()
.resolveAuditable(workItem, IWorkItem.FULL_PROFILE, monitor)
.getWorkingCopy();
workingCopy.setHTMLDescription(XMLString.createFromPlainText("XXXXX"));
IStatus saveStatus = fWorkItemServer.saveWorkItem2(workingCopy, null, null);
to save work item changes, but it only succeeded when the status of the work item changed. If I change other data but do not modify the status, the execution cannot succeed, and no error is reported.
Are there other methods to save work item modifications?
Accepted answer
Have you looked at any of the examples here: https://rsjazz.wordpress.com/?s=saveWorkItem&submit=Search ?
There are several follow up actions that do similar things - including code - in my blog.
I have done this countless times and I find it quite unbelievable that you do not get a save status or an exception.
If you follow the extensions workshop you should also be able to step through the code. This would also allow you to easily look at the interfaces to see which methods are available (e.g. saveWorkItem3()) and search for the usage of saveWorkItem*() in the SDK code.
If you follow the extensions workshop you should also be able to step through the code. This would also allow you to easily look at the interfaces to see which methods are available (e.g. saveWorkItem3()) and search for the usage of saveWorkItem*() in the SDK code.
Comments
Thank you very much. I have read some of these articles and applied them to my code, which is really helpful to me. I think it was because I thought too little that caused this error, and now I have solved the problem.
You should also consider to protect the work item save to avoid a recursive save caused by the second save. This ruins your day and crashes the server. This is demonstrated in some of the examples above by using additional save parameters.