Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

missing sprint items in history of an issue

Mitra Nami
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 23, 2022

Hi, I’ trying to use the Jira API

``/rest/api/2/search?jql=project={projectId}&expand=changelog&maxResults=100&startAt=0&fields=customfield_10020 ```

to see the issues for a given 'projectId'. I need to see what sprints each issue belong to so I'm including field 'customfield_10020' which is an array of strings containing name, id, state etc of each sprint:

"customfield_10020": [
      "com.atlassian.greenhopper..[id=25,rapidViewId=236,state=CLOSED,name=Sprint 1,startDate=2021-01-06T15:00:08.698-05:00,endDate=2021-01-20T10:00:00.000-05:00,completeDate=2021-01-21T08:53:09.345-05:00,sequence=106,goal=<null>]",
     ]
I also expanded the 'changelog' to look at the histories of 'Sprint' changes for issues.
The problem is that for some issues, the field "customfield_10020" is null but when I look at changelog -> histories for the issue, I find 'items' arrays with field 'Sprints'. for example:
{
  "field""Sprint",
 "fieldtype""custom",
  "from""515",
  "fromString": "Sprint_1",
   "to""1028",
    toString": "Sprint_2"
}
My question is shouldn't 'Sprint_1' and 'Sprint_2' be part of "customfield_10020"?
I also have this problem in reverse. For some issues, "customfield_10020" has multiple sprints but I don't see any record of sprint changes in changelog -> histories. (i.e. I don't see any items with field "Sprint".)
I'm new to Jira API, so I really appreciate it if someone could explain to me why I see these inconsistencies. My assignment  is to get the sprints and sprint changes of issues for a given projectId. 
Thank you!

2 answers

0 votes
Mitra Nami
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 8, 2022

Update:

So I just completed my assignment which was to create a sprint burndown chart for a given projectId (similar to the one in Jira reports).

After a little investigation I found out that the field 'customfield_10020' only contains sprints that the issue is currently part of. For example, if an issue was removed from a sprint then the sprint info will also be removed from ‘'customfield_10020' . So to consider all the sprints an issue has ever been part of you need to look into the history items of the issue as well.

As for my second question, looking at history items whose ‘field’ is ‘Sprint’ does not give you a complete list of all the sprints an issue has been part of.  If an issue is directly created in the sprint it doesn’t create a history item, so you have to look at ‘'customfield_10020'  and the date the issue was added to the sprint is therefore the creation date of the issue.

For example, it is possible to have an issue like this:

{

    “id”: 10,

  “fields”: {

         "customfield_10020": null,

         "created": “2022-01-25T19:02:49.603-0500"

     },

    "changelog": {

         "histories": [

              “created”: “2022-01-27T15:02:49.603-0500"

“items”: [

    {

  "field": "Sprint",

  "fieldtype": "custom",

   "from": "1",

  "fromString": "Sprint_1",

   "to": null,

     toString": null,

    }
 ]
         ]
     }
}

 This issue was created directly in ‘Sprint_1’ at “2022-01-25T19:02:49.603-0500" and then at “2022-01-27T15:02:49.603-0500", it was moved from “Sprint_1” to backlog.

0 votes
Yuliia_Borivets__SaaSJet_
Atlassian Partner
February 28, 2022

Hi @Mitra Nami 

I'm not good with coding and API, so I'd like to propose an alternative solution from my team. 

If you're on the cloud, check out the Issue History for Jira app. Here you can easily filter by Project, Assignee, Sprint, and choose any date range you need. As result, you've got a changelog for the list of issues. 

sprint changelog.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events