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

Add multiple references to the work item at same time using server api

Hi,

I am trying to add the list of work item as a "Tracks" link in parent work item. I had written below code for that.

for (IWorkItem workItem : workItemList) {

 referencesTask = workItemServer.resolveWorkItemReferences(parentWorkItem, monitor);
 
referencesTask.add(WorkItemEndPoints.TRACKS_BY_ITEMS,WorkItemLinkTypes.createWorkItemReference(workItem ));
  
 saveWorkitem(parentWorkItem,saveParameter,workItemServer,referencesTask);

}

Currently I creating reference of existing work item with parent work item of link type "Tracks" this is creating reference one by one by calling save operation. Is there any way to do it on only by calling one save operation.
Please provide useful link for above.





0 votes


Accepted answer

Permanent link
Yes, you can. See https://rsjazz.wordpress.com/2012/09/20/the-rtc-workitem-server-link-api-linking-to-work-items-and-other-elements/ method

linkWorkItemsCLM 

You can add multiple references and save them with saveWorkItem3()

Ralph Schoon selected this answer as the correct answer

0 votes

Comments

Hi Ralph,


Thanks for the reply.
I go through above mentioned link and I was able to link multiple references of work item but when I tried to save the work item then at a single save operation I can able to save only link at a one save operation. Suppose if I added 5 links then for each loop I have to call save operation. Is there any way to save all links on by calling single save operation in code. Due to multiple save operation it decrease performance.


2 other answers

Permanent link
Hi Ralph,

I created custom follow up plugin to read the children of workitem and create the "Track" type of link for all the children workitem in same parent workitem by following logic :

IWorkItemReferences referencesTask = null;
for (IWorkItem workItemTrackTo : workItemList) {
referencesTask = workItemServer.resolveWorkItemReferences(disciplineWorkItem, monitor);
referencesTask.add(WorkItemEndPoints.TRACKS_BY_ITEMS,WorkItemLinkTypes.createWorkItemReference(workItemTrackTo));
saveWorkitem(disciplineWorkItem,saveParameter,workItemServer,referencesTask);
}

Implemented above logic to create track of a children workitem with a parent workitem.
This logic is working fine but issue is that in browser if we change the tab in work item then it will show notification to "Refresh to get the latest updates" every time for parent work item.

Do you have any idea about why this is show notification to every time when click on other tab in browser.

0 votes

Comments

 I answered that this is to be expected and why below.


Permanent link
Does your prticipant create a new link? Does creating the link be a change to the work item open in the browser? Would this change be detected eventually in the browser?

For all I know the the participant changes the work item without notifyng the work item open in the browser. The browser will detect the change eventually however and tell you to refresh. You could even wait with the work item open in the browser for some time without changing the tab and the message would come up like it does if someone else changes the work item in another browser window. so I think this behavior is to be expected.

0 votes

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,948

Question asked: Nov 11 '16, 12:58 a.m.

Question was seen: 2,502 times

Last updated: Nov 14 '16, 2:22 a.m.

Confirmation Cancel Confirm