I am attempting to get a list of all sprints that belong to a particular board in a ScriptRunner script. I have been able to use the ProjectManager in the following manner:
'''
Hi @BSCI-SCMNM8-SVC
I dont use sprint manager, but the idea is get them from the tickets with JQL filter
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.greenhopper.service.sprint.Sprint
CustomField sprint = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10608")
List<Sprint>results = []
Issues.search('project = ITSMP and Sprint in openSprints()').each { issue ->
List<Sprint> sprints = (List<Sprint>)issue.getCustomFieldValue(sprint)
results.addAll(sprints)
}
results.unique().each { s -> log.warn(s.getName() + " Active -> " + s.getState().toString()) }
Results I got:
2023-07-27 03:41:27,060 WARN [runner.ScriptBindingsManager]: CW 27/2023 -> ACTIVE
2023-07-27 03:41:27,060 WARN [runner.ScriptBindingsManager]: CW 21/2023 -> CLOSED
2023-07-27 03:41:27,060 WARN [runner.ScriptBindingsManager]: CW 25/2023 -> CLOSED
In the results it also includes closed sprints cause some ticket has invoked in many sprint and not finish yet.
Hope it helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.