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

Get Sprint Name for Issue

Created 1 year ago, Updated 8 day(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
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