Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

flaimo October 27, 2020

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

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
John Chin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2021

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:

flaimo January 27, 2021

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
TAGS
AUG Leaders

Atlassian Community Events