Deleting a Link from a Work Item
Hello, sorry for all the questions, I am still trying to learn this API.
My question is how to delete a link from a work item. And what I mean by that, is along the lines of how to delete a parent link or child link from a work item. The problem is that we have an operational behavior that prevents a certain work item from being saved if it is not a 'Risk' or 'Issue' parent. So if the user accidently creates a link to a parent that is say a 'Meeting', then the work item cannot save, and even if you delete the 'Meeting' parent and try to create a 'Risk' or 'Issue' parent, the work item still thinks it has a 'Meeting' parent, and won't allow two parent references.
I'd like to programmatically delete a link to a parent that is not a 'Risk' or 'Issue', that way, the user can set the proper one?
I've done some research, and I believe you have to get a copy of the work item? I know IReference, and getNewReferences() and things like such will come in to play, I am just not quite sure how to go about deleting a link?
Thank you
2 answers
Hi,
The link below should have information that will help you out with deleting work item links with the Plain Java Client API
https://jazz.net/forum/questions/172804/rtc-is-there-any-way-to-delete-work-item-links-such-as-trace-to-in-batch
As far as I can tell, you basically use com.ibm.team.workitem.common.model.IWorkItemReferences.remove(IReference) to remove the references you no longer want. See com.ibm.js.team.workitem.commandline.helper.WorkItemUpdateHelper.updateLinks(ParameterValue, List<Exception>)