It's all about the answers!

Ask a question

How can I save a work item?


0
1
Kinny Kun (5183) | asked Feb 18 '09, 9:09 p.m.
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



permanent link
Patrick Streule (4.9k21) | answered Feb 19 '09, 8:58 a.m.
JAZZ DEVELOPER
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?

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

permanent link
Simon Fisher (1631710) | answered Feb 19 '09, 5:26 a.m.
JAZZ DEVELOPER
Hi,

Are you doing this on the server side, or client side? There are different ways of doing it at either end.

Thanks,

Simon

permanent link
Kinny Kun (5183) | answered Feb 19 '09, 3:00 p.m.
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?

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?

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

permanent link
yogesh arora (61) | answered Oct 04 '09, 2:27 a.m.
How can this be done on server side
Please let me know

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?

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?

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

Comments
Albert Yao commented Jun 30 '14, 1:52 p.m.

I also want the code of server side. 

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.