How to Retrieve Sprint History of an issue from JIRA Database

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Purpose

The purpose of this article is to show how to retrieve the historical information of Sprints for a given JIRA issue. 

Solution

 

  • Sprint custom field value on an Issue view screen will tell you all the Sprints the issue has been added into. The example below shows that issue MOK-3 has been added into Scrum Sprint 1, Scrum Sprint 2, Scrum Sprint 2, Scrum Sprint 3. (Scrum Sprint 2 exist twice because they are different Sprints - you will need to check in the database to get the ID of the Sprint and they will be unique)

 

  • You can click on the History tab of the issue and check for the value changes of Sprint custom field.

  • Use this SQL; please replace <Project key> and <issue number> to the respective values:

    select cfv.stringvalue, s."NAME" from customfieldvalue cfv 
    	join customfield cf on cf.id=cfv.customfield 
    	join jiraissue ji on ji.id=cfv.issue 
    	join project p on p.id=ji.project 
    	join "AO_60DB71_SPRINT" s on s."ID"=cfv.stringvalue::integer 
    where cf.cfname='Sprint' and p.pkey='<Project key>' and ji.issuenum=<issue number> order by cfv.id asc;

    Example result (JIRA issue from the screenshot above; MOK-3):

    select cfv.stringvalue, s."NAME" from customfieldvalue cfv join customfield cf on cf.id=cfv.customfield join jiraissue ji on ji.id=cfv.issue join project p on p.id=ji.project join "AO_60DB71_SPRINT" s on s."ID"=cfv.stringvalue::integer where cf.cfname='Sprint' and p.pkey='MOK' and ji.issuenum=3 order by cfv.id asc;
    -[ RECORD 1 ]---------------
    stringvalue | 1
    NAME        | Scrum Sprint 1
    -[ RECORD 2 ]---------------
    stringvalue | 2
    NAME        | Scrum Sprint 2
    -[ RECORD 3 ]---------------
    stringvalue | 3
    NAME        | Scrum Sprint 2
    -[ RECORD 4 ]---------------
    stringvalue | 5
    NAME        | Scrum Sprint 3

    (info) Gives you more information on Scrum Sprint 2 as well. 

Last modified on Sep 28, 2017

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.