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

Update the Labels for an Issue in Jira

Created 1 year ago, Updated 3 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
// you can set labels on creation/transition
def issue = Issues.create('SR', 'Task') {
    setSummary('Help me!')
    setLabels('first-label', 'second-label')
}

// you can *add* labels like this (using the syntax above would overwrite all labels)
issue = issue.update {
    setLabels {
        add('my-label')
    }
}

// you can also *remove* or *replace* labels
issue.update {
    setLabels {
        remove('first-label')
        replace('some-label', 'another-label')
    }
}
Having an issue with this script?
Report it here