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,295,634
Community Members
 
Community Events
165
Community Groups

Bulk remove/change issue links in Jira

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

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

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

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

No longer relevant with the latest version of JIRA

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 Sebastian Krzyzanowski likes this

Above only works for first 10 issues found.

Like Shaun Smith likes this

@Timothy Bassett this can still be done!

 

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

Then `More` > `Link` 

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! 

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)
}

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.

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 Oct 23, 2017

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

.pd

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 Oct 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.

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

@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?  ;-)

... Should have been addressed to @Joffrey Hammam , sorry Peter (but feel free to comment though...).

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

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. 

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

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!  

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

Like Ones Marsali likes this

@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 Anand likes this

Suggest an answer

Log in or Sign up to answer
TAGS

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