Skip to main content
Example scripts
arrow icon
To homepage
Jira
Cloud icon
Cloud

Copy Labels from a Parent Issue to all Linked-issues

Created 1 year ago, Updated 9 day(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
Jira
Language |
groovy
// Specify the Issue by key
def issue = Issues.getByKey("TEST-9");
String[] labels = issue.labels.collect{it.toString()}.toArray(new String[0]);

// Loop linked issue, outward links specifically
def successStatusByIssueKey = issue.getOutwardLinks().collect { linkedIssue ->
    Issues.getByKey(linkedIssue.outwardIssue.key).update {
        setLabels (labels)
    }
    linkedIssue.outwardIssue.key
}

successStatusByIssueKey ? "Labels successfully copied to issues: ${successStatusByIssueKey}. \nPlease see the 'Logs' tab for more information on what issues were updated." :
        "No outward links found. No labels copied."
Having an issue with this script?
Report it here