I want to remove "ContributesTo" link values programmatically depending on the values in affected app workitem attribute.
I had used LinkServiceLibrary approach to create "ContributesTo" link programatically for each value in the affected app workitem attribute. No I want to implement the removal functionality whenever I remove a workitem value from the affected app workitem attribute ,I want it to be automatically removed from the "ContributesTo" Link. The method for removal is as follows:
private void removeContributesToLink(IWorkItem sourceWorkItem,
IWorkItemReferences resolveWorkItemReferences = workItemServer.resolveWorkItemReferences(sourceWorkItem, null);
IEndPointDescriptor tracksEndpoint = ILinkTypeRegistry.INSTANCE
for (IReference link : references2) { IWorkItemHandle resolve = (IWorkItemHandle) link.resolve(); IWorkItem appWI = workItemServer.getAuditableCommon() .resolveAuditable(resolve, IWorkItem.FULL_PROFILE, null); if (!affectedWorkItems.contains(appWI.getId())) {
resolveWorkItemReferences.remove(link);
workItemServer.saveWorkItem3(sourceWorkItem, resolveWorkItemReferences, null, additionalParams); } But I am getting Stale Data Exception when running the code. Can you please give some insights on this issue. Is there any other methods to remove links from a workitem using LinkServiceLibrary?? |
One answer
Ralph Schoon (63.6k●3●36●47)
| answered Mar 22, 3:11 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Why would you run this on the server?
In general, I have provided some examples here: https://rsjazz.wordpress.com/
All posts are tagged and searchable. You can fetch/resolve the sourceWorkItem immediately before saving it. This usually worked for me. |
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.