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

RTC how to update programmatically workitems?

 Hi

I need to update a workitem in a operationParticipant, i need to add a new subscriber.

i already retrieved the subscriber,and I got the subscription list of the workitem and added it to the list, but  the change doesnt appear in the UI, i suppose that i need a way to do a commit or save the workitem.

I m doing this in the server side, in a follow up action

1 vote



2 answers

Permanent link
 You need to do the commit of the changes, and then you should refresh the UI, so you can see the changes.  You can see some of the more common ways of doing these things in the RTC 4.0 Extensions Workshop (https://jazz.net/library/article/1000).

1 vote


Permanent link

You will need to add the IWorkItemServer service as a dependency to your plugin if you have not already done so. Once you have added the dependency, you can save your work item using the IWorkItemServer#saveWorkItem2() method as shown below: 

IWorkItem workItem = ... 
IWorkItemServer workItemServer = getService(IWorkItemServer.class);
workItemServer.saveWorkItem2(workItem, null, null);

1 vote

Comments

 Hi Jared


The code that you posted works when the workitem its not created, but when I am gonna used it on a created workitem i got a exception on the saveWorkItem2 method, the message its: Stale data, but i havent change the workitem, there is a way to refresh the workitem before save it?



I resolved the problem, first you need to retrive again the workItem:

wiServer = getService(IWorkItemServer.class); IWorkItem wi = (IWorkItem)wiServer.getAuditableCommon().resolveAuditable(newState, IWorkItem.FULL_PROFILE, monitor).getWorkingCopy();

and them you can modify the work item.

and them you save it, but then its goning to appear the a great problem, the propagation, the solution for that is in the next forum https://jazz.net/forum/questions/53983/avoid-participant-propagation

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
× 6,120

Question asked: Jul 30 '12, 9:22 a.m.

Question was seen: 5,393 times

Last updated: Jul 31 '12, 6:39 p.m.

Confirmation Cancel Confirm