Get Sprint Name for Issue

Overview

Obtain the name of the sprint that contains a specific issue.

Example

As a project manager, I want to know the sprints in which several issues are located — allowing me to plan efficiently. I can use this script as part of a larger script to obtain this information and view it at a glance.

Good to Know

  • You can get other attributes from the sprint, such as the id, specifying the corresponding attribute instead of name. Check all available attributes at the REST API response documentation.

Requirements

Jira Jira

    
// 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}'"
Discovered an issue? Report it here

Suggested for you