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

Update Multiple Fields

Features
Listeners
Created 10 month(s) ago, Updated 3 day(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
Jira
Language |
groovy
def eventIssue = Issues.getByKey(issue.key as String)

def toUpdate1CfId = "Custom Field 1"
def toUpdate2CfId = "Custom Field 2"
def toUpdate3CfId = "Custom Field 3"

def tomorrowStr = (new Date() + 1).format("yyyy-MM-dd'T'HH:mm:ssZ", TimeZone.getTimeZone("UTC")) // date format in iso8601

eventIssue.update{
    setFixVersions("1.1")
    setComponents("My Component")
    setDescription("A generated description")
    setCustomFieldValue(toUpdate1CfId, "Some text value")
    setCustomFieldValue(toUpdate2CfId, tomorrowStr)
    setCustomFieldValue(toUpdate3CfId, "admin")
}
Having an issue with this script?
Report it here