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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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 John Chin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

556 views 15 18
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you