Transition Issues
Transition issues using HAPI, with examples for updating fields and skipping permissions while you transition issues.
Migrating to Jira Cloud? This feature is available in Cloud. |
Transitioning issues
To transition an issue, run the following script from the script console:
def issue = Issues.getByKey('ABC-1')
issue.transition('Start Progress') Updating fields while transitioning issues
You can also update fields during a transition. For example:
def issue = Issues.getByKey('ABC-1')
issue.transition('Resolve Issue') {
setResolution('Done')
setComment('resolving this issue')
} Skipping conditions, validators, and permissions while transitioning issues
You can use transitionOptions to skip conditions, validators and permissions during a transition. For example:
def issue = Issues.getByKey('ABC-1')
issue.transition('To Do') {
transitionOptions {
skipConditions()
skipPermissions()
skipValidators()
}
}Known limitation when transitioning from a post-function
Due to a limitation, we recommend against calling issue.transition() on the current issue inside a custom script post-function. When this is done, the transition is recorded in the issue's activity history, but the issue's current status may not update correctly.
Workaround
Use a Custom Listener instead. If the listener updates system fields (such as Assignee or Summary) of the issue being transitioned, those changes are overwritten when the transition finishes, unless you also set them on event.issue. For more information, see Listeners and issue transitions.