Skip to main content
Example scripts
arrow icon
To homepage
Jira
Data centre icon
Data Center

Search and Link Issues

Created 1 year ago, Updated 6 month(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
Jira (8.0 - 8.19)
compatibility bullet
ScriptRunner For Jira (7.10.0)
Language |
groovy
def matchingIssuesJqlQuery = """
    project = 'SR' 
    AND component = Safari 
    AND labels IN (Elephant, Hippo)
"""
def matchingIssues = Issues.search(matchingIssuesJqlQuery)
def featureIssue = Issues.getByKey('SR-1') // Issue which all the other issues will be linked to

matchingIssues.each { issue ->
    // Other link type values can be set depending on the
    // Outward/Inward Descriptions in "Issue linking" configuration, e.g.:
    // 'blocks', 'is blocked by', 'clones', 'is cloned by', etc.
    issue.link('relates to', featureIssue)
}
Having an issue with this script?
Report it here