Bulk remove/change issue links in Jira

Andrew October 23, 2017

I have some tickets with 100+ issue links associated with them.  Is there any way to bulk remove/change links without having to individually delete each link one-by-one?  Very time consuming when a large change needs to be made.  I have looked all over the forums, but with no success.  There are other great bulk change capabilities, but I can't find anything on issue links.

Thanks!

6 answers

13 votes
Joffrey_Hamman October 24, 2018

There is a simple way to link multiple issues to another one:

  1. Open the issue you wish to link to multiple issues.
  2. Select More > Link to display the Link dialog box.
  3. Ensure that the JIRA Issue item is selected at the left of the dialog box.
  4. Below the Issue field, click on the search for an issue link to specify a JQL query which regroups the issues you want to link to the current one.
  5. Click on the link Advanced Search from the Find JIRA issues window.
  6. Enter the specific JQL query and select the issues.
  7. The selected issues should appear in the Issue field.
  8. Click the Link button at the bottom of the dialog.

Note:
If you want to link to 10+ issues, you will need to:
Run the specific JQL query from the Issue Navigator
- Export the search result from Jira to Excel
Copy the issue-key column
Paste in a text editor and replace newline with space or tab
- Paste all the issue keys in the Issue field from the Link dialog box

Hemanth Raju May 13, 2019

Hi, i have similar problem;

I have 50+ test cases linked to a user story; later i found those test cases not related to that user story.

Could you please advise, how to un-link those test cases at once instead of removing one after one?

 

Thanks in advance,

Hemanth

Nate Villaume September 24, 2021

When I paste the strings into the issue field, the pop-up only allows me to select one at a time. 
The KEY is to IGNORE the popup. Click back on the dialog box and your 10+ issues will be parsed. 

Like # people like this
Sergey Shoshin April 7, 2023

Looks like there is no possibility to search by JQL during linking in Jira ticket.

So, 

>>

  1. Below the Issue field, click on the search for an issue link to specify a JQL query which regroups the issues you want to link to the current one.
  2. Click on the link Advanced Search from the Find JIRA issues window.

 

This is not possible.

Like # people like this
6 votes
Timothy Bassett July 10, 2021

No longer relevant with the latest version of JIRA

Sebastian Krzyzanowski September 1, 2021

Hi Timothy - why is this no longer relevant... how can this be achived via the new latest version of JIRA? 

Like # people like this
Like # people like this
Teri Michaels December 8, 2021

Above only works for first 10 issues found.

Like # people like this
Bradley Stannard June 14, 2022

@Timothy Bassett this can still be done!

 

On the ticket click the 3 dots and select `See old view`

Then `More` > `Link` 

Like Sam Whitlow likes this
Sergey Shoshin April 7, 2023

Above only works for first 10 issues found.

@Teri Michaels you can set a breakpoint and change request from 10 to 200. It will return more:

 

Screenshot at Apr 07 17-01-09.png

5 votes
Tom Hawkins October 9, 2019

https://jira.atlassian.com/issues/?jql=text%20~%20%22bulk%20link%22 has lots in this area, I've just voted for https://jira.atlassian.com/browse/JRASERVER-2428 but "Not Being Considered" doesn't fill me with confidence, however anyone else who doesn't want to go down the "unideal workaround" route, recommend do the same. I realise it may not be simplest thing to achieve, but something in Bulk Edit that works like labels eg. Find and Remove These, Add, Replace all with, then selecting other issues, then bulk linking, would be much better please Atlassian! 

3 votes
Scott Boisvert August 22, 2019

If you have ScriptRunner you can use a script. I'm in the process of upgrading from 7.13 to 8.3 and found that there are some functions that no longer work in 8.3 so I had to write two different scripts. Note, this will delete all links from all issues within the filter, use with caution.

For 7.13:

Credit to Adaptavist for the filter code on this one: https://scriptrunner.adaptavist.com/4.3.6/jira/recipes/misc/running-a-jql-query.html

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter

import org.apache.log4j.Category

def Category log = Category.getInstance("com.onresolve.jira.groovy")
log.setLevel(org.apache.log4j.Level.DEBUG)
log.debug "debug statements"

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

// edit this query to suit
def query = jqlQueryParser.parseQuery("Your JQL Filter")

def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())

log.debug("Total issues: ${results.total}")

results.getIssues().each {documentIssue ->
//log.debug(documentIssue.key)

// if you need a mutable issue you can do:
def issue = issueManager.getIssueObject(documentIssue.id)

// do something to the issue...
log.debug(issue.key)
ComponentAccessor.issueLinkManager.removeIssueLinks(issue, user)
}

For 8.3:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.query.Query

import org.apache.log4j.Category

def Category log = Category.getInstance("com.onresolve.jira.groovy")
log.setLevel(org.apache.log4j.Level.DEBUG)
log.debug "debug statements"

def searchService = ComponentAccessor.getComponent(SearchService)
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def results = searchService.search(user, jqlQueryParser.parseQuery("Your JQL Filter"), PagerFilter.getUnlimitedFilter())
def issueManager = ComponentAccessor.getIssueManager()

results.getResults().each
{
def issue = issueManager.getIssueObject(it.id)
log.debug(issue.key)
ComponentAccessor.issueLinkManager.removeIssueLinks(issue, user)
}
Christian Pascher
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.
August 4, 2020

I would highly recommend to use 

ComponentAccessor.issueLinkManager.removeIssueLinksNoChangeItems(issue)

instead of  

ComponentAccessor.issueLinkManager.removeIssueLinks(issue, user)

I did tests with Oracle & PostgreSQL and Server & DC and the method removeIssueLinks() floods the db and could make Jira not reacting anymore so you need a restart - or taking 10+ hours to remove thousands of links.

removeIssueLinksNoChangeItems() doesn't creates ChangeItems for the Change History.

0 votes
Anand March 8, 2022

09/03/2022: Cloud Based:

1. When i used the JQL search to get all the jira links, I see in the result only a number which fills the window and not able to load beyond 10

2. Tried the same with Edit, Link and used filter but in this I need to manually select the check box and only 50 show up and rest have to be manually loaded. 

Overall experience - BAD

Not sure if there is a easier ways yet

0 votes
Peter DeWitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 23, 2017

@Andrew, have you tried exporting the issues to excel, removing the links and then importing?

.pd

Andrew October 24, 2017

Thank you.  I have not tried that.  Will that change the issue ID?  Trying to find a better way, but perhaps that could work.  I guess there is no way to do this within the tool as you can with the other bulk updates?

Peter DeWitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 24, 2017

no - the key will remain the same - try it out on a single issue (preferably in a dev server) to get the feel of it.

Eric Roller May 21, 2018

This looks like it could work in theory. However, this is a show stopper: https://jira.atlassian.com/browse/JRACLOUD-63388

Bo Bøgvald February 25, 2019

@Peter DeWitt, I am trying to do your work around, and gets to the point where I can paste the list of issues into the issue field in the link dialog box. But then all the issues are listed below, and I am only allowed to select one of them. Any work around to that?  ;-)

Bo Bøgvald February 25, 2019

... Should have been addressed to @[deleted] , sorry Peter (but feel free to comment though...).

Joffrey_Hamman February 25, 2019

Hi Bo,

Do the following step:
Paste in a text editor and replace newline with space or tab
Paste all the issue keys in the Issue field from the Link dialog box

It should display something like:
image.png

After doing it, just click outside the entry box, it will evaluate the result:
image.png

Like # people like this
Bo Bøgvald February 26, 2019

That was exactly what (I thought) I did :-) But I am realizing that I pressed enter before pressing the link button. Thanks for helping me out on this.... Much appreciated.

For some reason, it works for me even when copy/paste directly form the Excel sheet, no need for editing in the text editor. 

Pietro March 15, 2019

This seems like a relatively simple thing to do however copying to a from excel seems a little cumbersome to me. 

Surely Atlassian could find a more elegant solution without to much difficulty

Like # people like this
Marcus Lillemägi March 25, 2019

i agree that this works but not optimal (you should be able to keep links when creating several issues

create several.pngand you should be able to easily copy links from other issue!  

Leigh Roach July 26, 2019

This doesn't work in the new view, unfortunately, but you can still switch back to the old view.

Like Ones Marsali likes this
Sravanthi Boggaram October 30, 2020

@Peter DeWitt Hi I tried doing that by using external system import of a CSV with blank link "Activity" field. But it did not delete or remove the links in by issues.

 

Any other solution to Bulk Delete links? I have about 135 issues for which I need to delete the currently present links.

Like # people like this
Suresh Mantrala June 8, 2023

Our situation on Jira Cloud- Issue 1 linked to Story A via Relates to and Issue 2 linked to Story B via Relates to. Like this there are 700+ issues. Queried project = ABC and issuetype = "Test" and issueLinkType = Relates. Using External System Import when Import completed with settings as mentioned in screen shotCapture.PNGwe observe that for example FSS-435, which was having Relates to relation with FRM-66 & FRM-2480 earlier, now has Outward Test link to FRM-66 & FRM-2480 in addition to the Relates to links earlier. 

Atlassian recommended REST API way https://confluence.atlassian.com/jirakb/how-to-use-rest-api-to-add-issue-links-in-jira-issues-939932271.html#HowtouseRESTAPItoaddissuelinksinJIRAissues-Editinganissue and provides the open Bug https://jira.atlassian.com/browse/JRACLOUD-63388. But our users cannot do this update one-by-one. Any ideas other than https://marketplace.atlassian.com/apps/1220382/jira-cloud-for-google-sheets-official?hosting=cloud&tab=overview ?

Suggest an answer

Log in or Sign up to answer