How can I save a work item?
Hi,
How can I save a work item if I only have the IWorkItem object? What I want to do is I want to save the work item after I append comments to the work item. Here is how I append the comments: (workitem is an IWorkItem object) IComments comments = workitem.getComments(); IComment c = comments.createComment( repo.loggedInContributor(), XMLString.createFromPlainText("test")); comments.append(c); So now, how can I save the workitem? Any help is appreicated. Thanks alot. |
4 answers
How can I save a work item if I only have the IWorkItem object? In general, you would do this to create a new work item: IWorkItemWorkingCopyManager workingCopyManager= workItemClient.getWorkItemWorkingCopyManager(); IWorkItemHandle handle= workingCopyManager.connectNew(fgDefectType, null); WorkItemWorkingCopy workingCopy= workingCopyManager.getWorkingCopy(handle); workingCopy.getWorkItem().setHTMLSummary(XMLString.createFromPlainText(getName())); workingCopy.save(null); If you have an existing item, use connect(handle) instead of connectNew(type) on the working copy manager. Please see also https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation -- Regards, Patrick Jazz Work Item Team |
Hi,
Are you doing this on the server side, or client side? There are different ways of doing it at either end. Thanks, Simon |
Thanks alot! I can now saved the work item.
To answer the previous question, I'm doing this on the client side. Thanks. How can I save a work item if I only have the IWorkItem object? In general, you would do this to create a new work item: IWorkItemWorkingCopyManager workingCopyManager= workItemClient.getWorkItemWorkingCopyManager(); IWorkItemHandle handle= workingCopyManager.connectNew(fgDefectType, null); WorkItemWorkingCopy workingCopy= workingCopyManager.getWorkingCopy(handle); workingCopy.getWorkItem().setHTMLSummary(XMLString.createFromPlainText(getName())); workingCopy.save(null); If you have an existing item, use connect(handle) instead of connectNew(type) on the working copy manager. Please see also https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation -- Regards, Patrick Jazz Work Item Team |
How can this be done on server side
Please let me know Thanks alot! I can now saved the work item. How can I save a work item if I only have the IWorkItem object? In general, you would do this to create a new work item: IWorkItemWorkingCopyManager workingCopyManager= workItemClient.getWorkItemWorkingCopyManager(); IWorkItemHandle handle= workingCopyManager.connectNew(fgDefectType, null); WorkItemWorkingCopy workingCopy= workingCopyManager.getWorkingCopy(handle); workingCopy.getWorkItem().setHTMLSummary(XMLString.createFromPlainText(getName())); workingCopy.save(null); If you have an existing item, use connect(handle) instead of connectNew(type) on the working copy manager. Please see also https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation -- Regards, Patrick Jazz Work Item Team |
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.