It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get OPEN / FUTURE sprints on an issue with closed sprints? Edited

I have a ScriptRunner listener, which gets the Sprint for an updated Issue

def customFields = get("/rest/api/2/field")
.findAll { (it as Map).custom } as List<Map>

def inputid = customFields.find { == 'Sprint' }?.id

def sprints = issue.fields[inputid]

The problem is the sprints returns the following object for issues that have old Sprints in the field:

[com.atlassian.greenhopper.service.sprint.Sprint@68451349[id=3,rapidViewId=1,state=CLOSED,name=180819,goal=,startDate=2018-08-11T22:00:07.984Z,endDate=2018-08-18T22:00:00.000Z,completeDate=2018-08-19T23:55:04.664Z,sequence=3], com.atlassian.greenhopper.service.sprint.Sprint@4685dba[id=4,rapidViewId=1,state=FUTURE,name=180916,goal=,startDate=<null>,endDate=<null>,completeDate=<null>,sequence=7], com.atlassian.greenhopper.service.sprint.Sprint@24ed7d97[id=8,rapidViewId=1,state=CLOSED,name=180826,goal=,startDate=2018-08-19T13:59:07.365Z,endDate=2018-08-26T13:59:00.000Z,completeDate=2018-08-26T22:39:33.453Z,sequence=4]]


  1. how do I only return the Sprint that has state=FUTURE or state=OPEN? I am not sure if I should iterate and check "State" or if there is a faster way, or how an iteration would work.
  2. [ Bonus ] How do I return only the "name" for that Sprint?

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Agile

Overview of Advanced Roadmaps UI + Get started with Automation for Jira - Demo Den September 2020

Deliver better and faster value to your customers with the Jira automation platform. Watch this Demo Den series below to learn how to use the new interface and set up automation rules to help your te...

1,292 views 3 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you