Goal: I am trying to get the Sprint Name the OPEN / FUTURE sprint value for an issue.
I currently have the following script using ActivistScriptRunner listener.
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 this returns the sprints associated with an issue as follows:
[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]]
And I don't know how to extract sprint name for the OPEN / FUTURE sprint from this result.
Question:
- Is there an easier way to do this than I am pursuing? e.g. a single REST API get method that sends back the OPEN / FUTURE sprint name, or
- Is there a way to extract the sprint name for the OPEN / FUTURE sprint from "sprints". I have tried "Get" but apparently it is not a support method, since "sprints" is an object and not an array or list.