Update Issues
Updating an issue is equivalent to doing Edit Issue in the user interface.
To update an issue, run the following script from the script console:
In this example we're updating the summary of an issue and setting the description.
def issue = Issues.getByKey('ABC-1')
issue.update {
setSummary('an updated summary')
setDescription('hello *world*')
}
The issue
variable above is a standard com.atlassian.jira.issue.Issue
. So you can update an issue like this anywhere you have a com.atlassian.jira.issue.Issue
object.
Working with workflow functions
Sometimes you need to change the fields on an instance of an issue without saving the changes to the database. In these cases, you will have an instance of MutableIssue
—for example, the issue
variable in a workflow post-function.
You can use the same API to set system and custom fields as described below, by using set {...}
instead of update {...}
. For example, to add a named fix-version in a post-function:
issue.set {
setFixVersions {
add('v2.0')
}
}
The Jira API provides many setters on MutableIssue
, and you can mix and match with ours:
issue.setSummary('Hello')
issue.set {
setFixVersions {
add('v2.0')
}
}