Does ScriptRunner support creating filters with subtasks grouped by parent

I want to list all the issues in a given project along with their subtasks, but I want the subtasks to be GROUPED under their parent issue. Is this possible with ScriptRunner? I would be willing to purchase ScriptRunner if it can do this, but I would like to first confirm that it supports this functionality.

2 answers

Yes. this would be possible with Scriptrunner.

I think the simplest way to do this with ScriptRunner would be to add a scripted field which you use in an ORDER BY clause. The value of the scripted field of a parent would be based on the ID of itself. The value of the scripted field of any subtask would be the ID of the parent plus some suffix that makes it sort later. 

Well, I'm stuck. I installed ScriptRunner (v. 2.1.16) and I'm following the documentation on Scripted Fields (https://scriptrunner.adaptavist.com/latest/jira/scripted-fields.html) but I have no idea how to create a script that would accomplish what you are suggesting. By any chance, could you provide more details?

UPDATE: OK I think I've got it. THis is what I'm using if (issue.issueTypeObject.name == "Sub-task") (issue.parentId + "_" + issue.id)as String else issue.id as String

1 vote

I would suggest the same as Doug, and your code looks ok to me. Although I would use:

if (issue.issueTypeObject.isSubTask())
	(issue.parentId + "_" + issue.id)as String
else
     issue.id as String

that way it will work for all sub-task types.

And don't put the field on any screen, as it's not useful in that context.

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

182 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you