I have a ScriptRunner listener, which gets the Sprint for an updated Issue
def customFields = get("/rest/api/2/field")
.asObject(List)
.body
.findAll { (it as Map).custom } as List<Map>
def inputid = customFields.find { it.name == '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]]
Questions:
Recommended Learning For You
Level up your skills with Atlassian learning
Learning Path
Apply agile practices
Transform how you manage your work with agile practices, including kanban and scrum frameworks.
Learning Path
Configure agile boards for Jira projects
Learn how to create and configure agile Jira boards so you can plan, prioritize, and estimate upcoming work.
Jira Essentials with Agile Mindset
Suitable for beginners, this live instructor-led full-day course will set up your whole team to understand how to use Jira with an agile methodology.