You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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
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.
To get the sprint id, you can click on the issue navigator icon as shown in the screenshot below:-
Once that icon is clicked, you will be redirected to the JQL Query page, as shown below.
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
2. For the Mock 3 issue, the total Story Points used is 12, as shown below:-
3. From the Mock 4 issue, the total Story Points used is 15, as shown below:-
4. From the Mock 5 issue, the total Story Points used is 12, as shown below:-
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.
I hope this helps to answer your question. :-)
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.