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, 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();
    copyManager.save(new WorkItemWorkingCopy[] { wc }, monitor);

    copyManager.disconnect(workItem1);
    

One answer



permanent link
Ralph Schoon (62.3k33643) | answered Jun 13, 9:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jun 13, 9:21 a.m.

 You should use a WorkitemOperation to update work items. See https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ and search for WorkItem Operation.


  

Your answer


Register or to post your answer.