How to get all users story and sub-tasks under user story?

Raj Kumar March 22, 2016

We want  to separate out some of users story / sub-tasks based on some fields in user story. 

Condition  - all user story and sub-tasks if project team = "adapter".

Please note we have project team field for user story only not for sub-tasks. Please provide any field we can write using script runner plugins to get above data. 

Thanks,

Raj Kumar

5 answers

1 accepted

4 votes
Answer accepted
Kristian Walker _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.
March 23, 2016

Hi Raj,

The hasSubtasks() script JQL function provided by the ScriptRunner plugin would allow you to find out this information if you used it in a JQL query similar to the one below which shows all issues that are of type story and contain the value adapter in the project team field.

issuetype = Story and "project team" = adapter and issueFunction in hasSubtasks()

You can the configure the columns shown in the returned JQL query to show the subtasks column which will show all of the subtasks for each query as shown in the screenshot below.

image2016-3-23 10:53:10.png

This query could then be saved as a filter and placed in a filter results gadget in order to share it with other users on a dashboard.

I hope this helps.

Thanks

Kristian

Raj Kumar March 23, 2016

Thanks. We are able to see the sub-tasks links but if we use the same field in Agile Scrum board unable to see the sub-tasks list like a normal board. See the attached screen shots for more information. 

Like Jose Cabrera likes this
Raj Kumar March 23, 2016

Kristian Walker _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.
March 23, 2016

Hi Raj,

Thankyou for your response. It looks as if you question is in fact related to how JIRA Agile (JIRA Software) displays fields on cards.

By design the cards in JIRA Agile can only show three fields but you can show the Sub Tasks field on a card as shown below.

image2016-3-23 11:8:50.png

I would look to implement the JQL query provided above as a quick filter or swimlane so that you could pull in all issues which are stories with the project team adapater and have sub tasks into a filter view or a seperate swimlane.

I hope this helps

Kristian

Raj Kumar March 23, 2016

Thanks. I am able to see the sub-tasks ID But unable to move the sub-tasks from board itself. Like its work in scrum board. 

Kristian Walker _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.
March 23, 2016

You would need to ensure you display the sub tasks on the board in order to be able to move them. You may want to change the query then to pull in sub tasks where the parent issues are of type story and have the project team field set. You could do this using the subtasksOf Script JQL function as described on the documentation page linked above.

An example of the type of JQL you may want is shown below but you will need to update this to suit your actual requirements.

issueFunction in subtasksOf("issuetype = Story and 'project team' = adapter")

I hope this helps.

Kristian

Like # people like this
Raj Kumar March 23, 2016

Great!!. Thank you very much kristian.

It's working now as expected. 

 

Kristian Walker _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.
March 23, 2016

Glad i was able to help.

If this solution is correct can you please mark it as accepted so that other users with similar questions can easily find it in future.

Thanks

Kristian

Abhishek mj July 30, 2017

Thank you so much this was very useful sql .

 

1 vote
kkr-projects July 10, 2020

The Scriptrunner costs extra and delivers essential functionality for filter stuff.

That's bad.

0 votes
Nicolas Courvoisier April 26, 2021

This post is old but if someone searches for the info, you can use the following in JQL now:

subtasks:

issuetype in subTaskIssueTypes()

 

standard issues:

issuetype in standardIssueTypes()

 

or specifically:

issuetype = Bug

issuetype = Task

issuetype = Story
0 votes
Alexander Cohen May 30, 2019

This thread needs to be updated. This solution no longer works in 2019. 

Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2019

Hello Alexander,

Actually, the query provided by @Kristian Walker _Adaptavist_ is still working on JIRA Server and JIRA Cloud Applications. You need the Scriptrunner plugin installed to use the subtasksOf issue function, as mentioned in the documentation below:

Script JQL Functions

That being said, can you please confirm if you have properly installed the Scriptrunner plugin?

If you have installed the plugin, can you please confirm if you are using JIRA Server or Cloud and what steps you are taking to reproduce the issue?

Let us know if this information helps.

0 votes
Tal_Cohen September 18, 2018

Thank you Kristian!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events