atlascommunity / jira-plugins-groovy

Jira Groovy plugin
https://atlasteam.ru
BSD 2-Clause "Simplified" License
66 stars 42 forks source link

can not get issue links #89

Open diaojunxian opened 3 years ago

diaojunxian commented 3 years ago

Our jira version is 8.12

As I want to validator script to check status of all linked issues before allowing transition, then try to get the issue links, I tried several ways:


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
import org.apache.log4j.Category
import com.atlassian.jira.issue.link.IssueLink;
import com.opensymphony.workflow.InvalidInputException
def Category log = Category.getInstance("com.onresolve.jira.groovy.LinkedIssues")

log.debug("issue key: " + issue.key)

List linkType = ["Duplicate"]

IssueLinkManager linkMgr = ComponentAccessor.getIssueLinkManager()

def inwardlinks = linkMgr.getInwardLinks(issue.id)

def outwardlinks = linkMgr.getOutwardLinks(issue.id)

def links = linkMgr.getIssueLinks(issue.id)

when tried in the workflow, and selected the Linked Issues and add the issue , but the log told that

inwardlinks = []

outwardlinks = []

links = []