Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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.

1

0 votes



4 answers

Permanent link
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

1 vote


Permanent link
Hi,

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

Thanks,

Simon

0 votes


Permanent link
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

0 votes


Permanent link
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

0 votes

Comments

I also want the code of server side. 

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: Feb 18 '09, 9:09 p.m.

Question was seen: 8,577 times

Last updated: Jun 30 '14, 1:52 p.m.

Confirmation Cancel Confirm