You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!

1

Remove Specific Links from an Issue

Overview

The main feature of this code is to remove multiple linked issues of a specific link type.

Example

As a Project Admin, I would like to remove the linked issues of a specific link type from the issue if they are not required anymore. This script enables me to do so by running the script in the script console.

Requirements

  • Jira Jira (8.20 - 8.22)
  • ScriptRunner for Jira ScriptRunner for Jira (6.58.0)
    
import com.atlassian.jira.component.ComponentAccessor final def issueKey = '' //Specify the Link Type ID final def linkTypeId = 10000 def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser def issueManager = ComponentAccessor.issueManager def issueLinkManager = ComponentAccessor.issueLinkManager def issue = issueManager.getIssueObject(issueKey) issueLinkManager.getOutwardLinks(issue.id).each { if (it.linkTypeId == linkTypeId) { issueLinkManager.removeIssueLink(it, loggedInUser) } }
Discovered an issue? Report it here