It's all about the answers!

Ask a question

How can you copy a workitem into a different project area using the java server API?

Shawn Carroll (3611) | asked Feb 05 '19, 12:37 p.m.
I'm trying to create a server extension that will copy of a workitem into a different project area on a work item save.

Right now I'm creating a new workitem, filling out the fields with data, and then using the ServerCopyToProjectOperation class to save it into a different project area. This was working fine on our 6.0.1 servers, but when the extension was moved to our 6.0.5 server, we started getting NoSuchMethodError with this class. Is there a different way to do this? I know the RTC client has the option to copy a workitem into a different project area but I don't know how to actually access that functionality from the server api.

This is the snippet of code I'm currently using:
        IWorkItemReferences workItemReferences = wiServer.resolveWorkItemReferences(newWI, null);
        WorkItemWrapper wiWrapper = new WorkItemWrapper(newWI, workItemReferences, null);
        ServerCopyToProjectOperation op = new ServerCopyToProjectOperation(targetArea, true, false, true);, wiServer, null, null);
        wiServer.saveWorkItem2(newWI, null, null);

Be the first one to answer this question!

Register or to post your answer.