Example scripts
To homepage
Jira

Get Sprint Name for Issue
App in script

ScriptRunner For Jira
by Adaptavist
Compatibility

Jira
Language |
groovy
// The issue key
final issueKey = 'TEST-1'
// Fetch the issue object from the key
def fields = get("/rest/agile/1.0/issue/${issueKey}")
.header('Content-Type', 'application/json')
.asObject(Map)
.body
.fields as Map
// Get sprint field from the issue fields as a Map
def sprint = fields.sprint as Map
// Get the Custom field to get the option value from
def sprintName = sprint.name // Note change .name to .id to get the ID of the sprint.
"The name of the current Sprint is '${sprintName}'"
Having an issue with this script?
Report it here