Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,362,877
Community Members
 
Community Events
168
Community Groups

Delete everything under "Issue Links" using Scriptrunner (including external links)

I have the situation that I want to completely purge all links under "Issue Links" for an issue. So far I only found code snippets on how to handle links to other issues, but I wonder how the groovy code must look like if I also want do delete links to external URLs and confluence pages. Is there an easy way to just "null" it?

1 answer

1 accepted

0 votes
Answer accepted

Hi @flaimo , I hope I'm not late answering the question here. You can utilise the RemoteIssueLinkService method to do the validation and delete the remote issue link safely.

I found a few community answers that has some sample groovy script on it:

I was able to get the removeRemoteIssueLink function from the first post to work.

If you ever need to completely delete all issue links this is the code that works for me (inside an Automation rule)

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.RemoteIssueLinkManager

// remove jira links
ComponentAccessor.issueLinkManager.removeIssueLinksNoChangeItems(issue)

// remove external links
def rilm = ComponentAccessor.getComponentOfType(RemoteIssueLinkManager.class)
rilm.getRemoteIssueLinksForIssue(issue).each {
rilm.removeRemoteIssueLink(it.getId(), currentUser)

 

Screenshot 2021-01-27 at 14.55.22.png

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events