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

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!

4 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

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 Marcus Lillemägi likes 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 Tom Hawkins likes 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.

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

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! 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

274 views 1 2
Join discussion

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