Need a JQL query for the user story and the defects associated with the User story using Script runner JQL functions.
We have defects linked to User story. We would like to see all defects related to the user story. We need a report that displays all the user stories and its associated defects and total count of defects related to the user story
Hello @Garden16_
What version of Jira are you using and what version of ScriptRunner are you using?
You should be able to use the linkedIssuesOf ScriptRunner function to get the Bugs linked to Stories.
First you construct the query that will get the stories you want; i.e.
project=x and issueType=Story
Add to that the linkedIssuesOf function to get issues linked to those stories.
project=X and issueType=Story or
issueFunction in linkedIssuesOf("project=X and issueType=Story")
Add criteria to limit the linked issues to only Bugs:
project=X and issueType=Story or
(issueFunction in linkedIssuesOf("project=X and issueType=Story") and issueType=Bug)
That will give you a list of the issue, but not in the format you showed. Jira does not natively have the capability to produce a report in that format.
You could use a ScriptRunner Scripted Field to keep track of the Bug issues linked to your Story.
https://docs.adaptavist.com/sr4js/latest/features/script-fields
All of my references to ScriptRunner documentation were to the latest version - 8.18.0. You would need to double check the documentation for the version you are actually using to confirm that the same functionality is available and used in the same manner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
(issueFunction in linkedIssuesOf("project=X and issueType=Story") and issueType=Bug)
when I run this query its shows the list of defects that linked to all issue types
its showing defects, tests, test execution issue types which are all linked to the defect.
If I flip the query it shows the story and every thing that is linked to the story
(issueFunction in linkedIssuesOf("project=X and issueType=Bug") and issueType=Story )
How will I create query that shows 'only issue type =bugs ' linked to the user story.
Please advise how to display only defect issue types linked to the user story
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
According to the documentation for ScriptRunner 6.56.0
...it should work the way I provided it.
Can you provide a screen image that shows the query actually being executed and the results, plus the details of one of the defects that is linked to an issue type other than Story?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In this scenario 90 is Test , 177 and 148 are defects
I wanted to display only defects that are linked to the User story . How do I achieve this.
I want to put in the Dashboard user story and their associated (linked) defects .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Linked Issues field you included in the columns will show all the linked issues of the listed issue. There is no method to change what is displayed in that field.
You asked for a list of defects that are linked to Stories. The first query I provided produces a list that includes each Story and each defect that is linked to one of the stories. Each Story and defect will be a separate item in the list.
If what you want is something like you've shown, then with ScriptRunner I think you would have to create another scripted field where you could insert a list of the issue keys for just the defects linked to a Story.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Garden16_
if you're open to solutions from the Atlassian Marketplace, this may want to have a look at the app that my team and I are working on, JXL for Jira.
JXL is a full-fledged spreadsheet/table view for your issues that allows viewing, inline-editing, sorting, and filtering by all your issue fields, much like you’d do in e.g. Excel or Google Sheets. It also comes with a number of so-called smart columns that aren’t natively available, the number of linked issues, and many other issue-link-related columns. With these, you should be able to build the view you're looking for in just a couple of clicks:
JXL also comes with a number of advanced features, including support for (configurable) issue hierarchies, issue grouping by any issue field(s), sum-ups, or conditional formatting - depending on your exact use case, I believe that these could be useful as well.
Note that this all just works, and doesn't require any scripting or automation whatsoever.
Any questions just let me know,
Best,
Hannes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.