RTC how to update programmatically workitems?
Hi
I need to update a workitem in a operationParticipant, i need to add a new subscriber.
i already retrieved the subscriber,and I got the subscription list of the workitem and added it to the list, but the change doesnt appear in the UI, i suppose that i need a way to do a commit or save the workitem.
I m doing this in the server side, in a follow up action
2 answers
You will need to add the IWorkItemServer service as a dependency to your plugin if you have not already done so. Once you have added the dependency, you can save your work item using the IWorkItemServer#saveWorkItem2() method as shown below:
IWorkItem workItem = ... IWorkItemServer workItemServer = getService(IWorkItemServer.class);
workItemServer.saveWorkItem2(workItem, null, null);
Comments
Hi Jared
The code that you posted works when the workitem its not created, but when I am gonna used it on a created workitem i got a exception on the saveWorkItem2 method, the message its: Stale data, but i havent change the workitem, there is a way to refresh the workitem before save it?
I resolved the problem, first you need to retrive again the workItem:
wiServer = getService(IWorkItemServer.class); IWorkItem wi = (IWorkItem)wiServer.getAuditableCommon().resolveAuditable(newState, IWorkItem.FULL_PROFILE, monitor).getWorkingCopy();
and them you can modify the work item.
and them you save it, but then its goning to appear the a great problem, the propagation, the solution for that is in the next forum https://jazz.net/forum/questions/53983/avoid-participant-propagation