It's all about the answers!

Ask a question

RTC Plain Java API, How to refresh/refetch a workitem as it is throwing MultiStaleDataException

Shwetha G (111) | asked May 30 '23, 2:21 a.m.

 hi Team,

We are trying to attach a workitem to the main workitem and then close the main workitem. On Closing the main workitem, API is throwing MultiStaleDataException : Stale Data

 IWorkItem workItem = workItemClient.findWorkItemById(workItem1.getId(), IWorkItem.FULL_PROFILE, null); 

is not fetching the fresh copy of the workitem.

Following is the code for the same :
IWorkItemWorkingCopyManager copyManager = null;
    IWorkItemClient workItemClient = (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);
    copyManager = workItemClient.getWorkItemWorkingCopyManager();

    copyManager.connect(workItem1, IWorkItem.FULL_PROFILE, null);
    WorkItemWorkingCopy wc = copyManager.getWorkingCopy(workItem1);
    IWorkItem workItemWorkItemCopy = wc.getWorkItem(); WorkItemWorkingCopy[] { wc }, monitor);


One answer

permanent link
Ralph Schoon (63.2k33646) | answered Jun 13 '23, 9:19 a.m.
edited Jun 13 '23, 9:21 a.m.

 You should use a WorkitemOperation to update work items. See and search for WorkItem Operation.


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.