Is there any way to delete bulk issue links at all once?

Kruthika R April 8, 2022

Hi, I wanted to delete almost 8000 issue links from my ticket. Is there any option to delete the links other than doing it manually?

2 answers

1 accepted

2 votes
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 15, 2022

Hi @Kruthika R

In your comment, you mentioned:-

Hi, I wanted to delete almost 8000 issue links from my ticket. 

Are all the 8000 issue links from one specific issue?

If yes, you could try something like this in the ScriptRunner console:-

import com.atlassian.jira.component.ComponentAccessor

def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issueManager = ComponentAccessor.issueManager
def issueLinkManager = ComponentAccessor.issueLinkManager
def projectManager = ComponentAccessor.projectManager

//Specify your Project Key
def project = projectManager.getProjectByCurrentKey('MOCK')

def issues = issueManager.getIssueObjects(issueManager.getIssueIdsForProject(project.id))

issues.each {
if (it.key == 'MOCK-1') {
issueLinkManager.removeIssueLinks(it, loggedInUser)
}
}

Else if it is from multiple issues, you will need to do this:-

import com.atlassian.jira.component.ComponentAccessor

def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issueManager = ComponentAccessor.issueManager
def issueLinkManager = ComponentAccessor.issueLinkManager
def projectManager = ComponentAccessor.projectManager

//Specify your Project Key
def project = projectManager.getProjectByCurrentKey('MOCK')

def issues = issueManager.getIssueObjects(issueManager.getIssueIdsForProject(project.id))

issues.each {
issueLinkManager.removeIssueLinks(it, loggedInUser)
}

Please note that the sample working code above is not 100% exact to your environment. Hence, you will need to make the required modifications.

You will need to modify the project's key accordingly before triggering the code in the ScriptRunner console.

I have done a basic test of removing 1000 links at once in my environment.

I hope this helps to answer your question. :)

Thank you and Kind regards,

Ram

Kruthika R April 18, 2022

Hi @Ram Kumar Aravindakshan _Adaptavist_ ,Thanks for the script. But I still couldn't delete the issue Links

The issue Links are from the same issue. I have attached the image of the issue Link which still exist even after running the code.issue link.JPG

Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2022

Hi @Kruthika R

In your comment, you mentioned:-

The issue Links are from the same issue. I have attached the image of the issue Link which still exist even after running the code.

If it is from only one issue, you can use the first example code that I have provided.

Please confirm, i.e. what are the issue link type(s) associated with your issue? Is it only one type as shown on your print screen?

Also, could you please provide a print screen of your Issue Links configuration as shown in the example below:-

issue_links.png

Thank you and Kind regards,

Ram

Kruthika R April 19, 2022

HI @Ram Kumar Aravindakshan _Adaptavist_ ,

Yes it is from one issue. we aren't aware of the issue link type and issue link configuration since it has been coming from Gitlab Integration. You can see the attached screenshot above.

Also I have tried with the code you sent it runs without any errors but no actions has been performed on the issue, The issue links still exists.

 

Thanks,

Kruthika

Kruthika R April 19, 2022

Capture.JPG

Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 21, 2022

Hi @Kruthika R

As requested in my previous comment:-

Also, could you please provide a print screen of your Issue Links configuration as shown in the example below:-

issue_links.png

Please provide a print screen of your Issue Links configuration. This is to confirm whether the links you have displayed on your print screen, as shown below, are provided by Jira.

Capture2.png

If the link does not exist on the Issue Links configuration page, it cannot be removed from Jira using ScriptRunner. Instead, you need to remove it from GitLab.

FYI, a ticket for this has also been created on GitLab

Thank you and Kind regards,

Ram

0 votes
Bibek Behera
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 8, 2022

Hi @Kruthika R .

This video has all you need for now,

https://www.youtube.com/watch?v=9-v_8IgzoZQ

If you get stuck at any place you can make use of the similar discussion in the community in the past.

https://community.atlassian.com/t5/Jira-Software-questions/Deleting-all-issues-at-once/qaq-p/1659450

Thanks to @John Funk  :) 

Kruthika R April 8, 2022

Hi @Bibek Behera , Thanks for reaching out.

But I wanted to delete the issue links that is associated to an single issue. I am doing it manually as of now But I wanted to know if there is any other option to bulk delete of issue links.

Like Srikanth Ganipisetty likes this
Bibek Behera
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 8, 2022

@Kruthika R ,

I don't think the same is available out of the box to unlink all the issue at once without using some automation. If this is once is a while case I would suggest you to do it manually as accidental deletion of links would be hard to trace in a list of 8000 links.

Like Kruthika R likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events