It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Using Scriptrunner to roll up sub-tasks story points to parent issue Edited

Hi, I know that is a hot subject among Jira, have more than 100+ threads about, suggestions with more than 3k total votes, but some reason still not solved inside Jira or some reason I don't know (the suggestion with 1.6K votes is from 2013!!!!).


As I don't like to give him im searching for the way to roll up the summing of the story points sub-tasks have into his parent issue, just to be clear about what I'm talking about is this:

Issues have sub-tasks under it; you can add story points field to sub-tasks

If you have an issue called "Story X" and under it, there are two sub-tasks with 6 story points each, then the logic is that the story will contain 12 story points, or at the minimum give the user the possibility to choose if this is how he wants to calculate story points.


So I have tried plugins and many customizations through Jira dashboard and didn't succeed, but I have found this script example under Scriptrunner documentation that rolls up time estimation to parent issue, with just simple 30 lines of listener code:


So my question is if someone knows how to tweak this code (because it looks pretty simple for someone who knows how to code JQL) to roll up story points to the parent issue?


Of course, if you have other solution or clear answer (not because "this is how it works" thing that I have saw from some "coaches" out there, because good products solve user needs, and not hold him back), I would like to hear that.



Hi Liran,

It should be possible to modify a few places in that script you referred.

I wrote a blog post about this about three years ago ( If you can't get it to work, feel free to reach out to me.

Hi! thank you very much, have you seen that is on the cloud? your article is on a server and not cloud, as I don't find "scripted field" under the add custom field, any idea?

Ah, I missed the cloud detail; I think modifying the script that Adaptavist provided is the way to go. 

Have any idea how and what to change?


I'm not sure how to do it :/

I'd start with modifying the line that has the number 2 next to it.

.queryString("fields", "parent,timeestimate") 

should get changed to

.queryString("fields", "parent,customfield_xxxxx") 

where the xxxxx is the id of the story point field.

Something like that. You also need to create the "Summed Subtask Estimate" field.

This is not tested so I may be wrong here.

So the steps you suggest are:

1. Create custom field

2. create a listener in Scriptrunner with the same code

3. change the strings mentioned above, according to the custome field?

Hi Liran,

I can confirm that you can modify the Store Subtask Estimates in Parent issue on Issue events example in the documentation to sum up story points.

I have included a link here to a modified version of this example that you can use to do this.

Please note that when configuring this example as a Script Listener you will need to:

  1. Ensure the script listener is configured to fire on the issue updated event.
  2. Ensure lines 14 and 22 are updated to reference the ID of the Story Points field in your Jira instance.
  3. Ensure Line 32 is set to the Story Points field as configured in the linked script above.

If this answer has solved your issue can you please accept it in order to mark this answer as correct for users who are searching for a similar issue.



Thank you so much, works like a charm!


I even disabled other plugin that does part of that, I'm gonna spread the word!

Hi Liran,

Thank you for confirming that issue has now been resolved.

Could you please mark this answer as accepted so that other users searching for the same question know this is a correct answer.



I think because this is a discussion and not a question I can't mark it as correct answer but I edit the title and wrote SOLVED.

Thank you Liran.

This is fine and will show people searching for a similar question that the answer is correct.



Hi Kristian, have any quick idea about the next problem:

The script works well, every time I add story points it updates the main parent story, the only problem that if I put sub-task in done, it does not update the story points (eliminate the summing of story points of done sub-task.

Also, it does not show how many story points made so far regarding sub-tasks, this could be much more complex as i understand, but at least minus the subtasks story when they have done, it should be pretty simple add in the code I guess.


Thank you again!

Hi Liran,

Thank you for your response.

The script is designed to just sum up the story points from all sub tasks and does not check what status a sub task is in.

You would either need to update the script to check the status of each sub task and not sum up its value if it is in the Done status or you would need to add a post function onto the sub task workflow to clear the value of the story points field when the sub task is put into the Done status.

Atlassian provide the Clear Field Value  post function out of the box which you could use to clear the story points on the sub task when it go's into the Sub Task status.




Log in or Sign up to comment

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you