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?
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.ComponentAccessordef loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUserdef issueManager = ComponentAccessor.issueManagerdef issueLinkManager = ComponentAccessor.issueLinkManagerdef projectManager = ComponentAccessor.projectManager//Specify your Project Keydef 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.ComponentAccessordef loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUserdef issueManager = ComponentAccessor.issueManagerdef issueLinkManager = ComponentAccessor.issueLinkManagerdef projectManager = ComponentAccessor.projectManager//Specify your Project Keydef 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
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
Hi @Bibek_ikuTeam_ , 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.
@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.
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.
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:-
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
It looks like you're new here. Sign in or register to get started.