What is the script runner query to get a list of STORY POINTS IN A SPRINT

vasanth May 9, 2023

Hi All 

What is the script runner query to get a list of STORY POINTS for a given set of SPRINT? (Like 3 to 5 sprints )

 

and also looking for a gadget 

most of the gadgets not supporting story points fields in gadgets.

 

can anyone help with this

 

Thank you

Vasanth

 

 

1 answer

1 accepted

1 vote
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 10, 2023

Hi @vasanth

For your requirement, you can use the working script below:-

import com.adaptavist.hapi.jira.issues.Issues
import com.adaptavist.hapi.jira.projects.Projects
import com.atlassian.greenhopper.service.sprint.SprintManager
import com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser

def project = Projects.getByKey('MOCK') // Change the Project Key

def sprintManager = PluginModuleCompilationCustomiser.getGreenHopperBean(SprintManager)
def sprintName = sprintManager.getSprint(2).value.name // Change the Sprint ID

Issues.search("project = ${project.key} and Sprint ='${sprintName}'").collect {
it.getCustomFieldValue('Story Points')
}.sum()

Please note that the sample working code above is not 100% exact to your environment. Hence, you will need to make the required modifications.

Also, for this code to work, please ensure you upgrade your ScriptRunner plugin to version 8.2.1 to use the HAPI feature.

Below is a screenshot of the code in the ScriptRunner console. 

image1.png

To get the sprint id, you can click on the issue navigator icon as shown in the screenshot below:-

sprint_id.png

Once that icon is clicked, you will be redirected to the JQL Query page, as shown below.

sprint_id_2.png

In the JQL query field, the Sprint id will be displayed.

Below are a couple of test screenshots for your reference:-

1. Below is the Sprint Board which displays the issues from which the Story Points will be extracted

test1.png

 

2. For the Mock 3 issue, the total Story Points used is 12, as shown below:-

test2.png

3. From the Mock 4 issue, the total Story Points used is 15, as shown below:-

test3.png

4. From the Mock 5 issue, the total Story Points used is 12, as shown below:-

test4.png

When the script is executed on the Script Console, it will sum up all the Story Points from all the issues currently in the Sprint. As shown below, the total points of all the 3 issues above totals 39 points.

image1.png

I hope this helps to answer your question. :-)

Thank you and Kind regards,

Ram

vasanth May 11, 2023

@Ram Kumar Aravindakshan _Adaptavist_ 

 

thank you

I wil check this.

 

Thank you

vasanth

Suggest an answer

Log in or Sign up to answer