Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I have a simple question about searching.

Sam Sa September 1, 2020

I need to search for several Use cases (UC-3 or UC-4 or UC-6 etc), and see a list of user stories that are associated with that Use Case.  (if the Use Case is a label on an Epic, the user stories underneath that epic would be listed).  Can this be done via code in the search field?

1 answer

0 votes
Ste Wright
Community Champion
September 5, 2020

Hi @Sam Sa 

Not natively when the Use Case is a label on an Epic.

You'd need an app with more advanced JQL functions, such as ScriptRunner. Apps like this allow you to apply a sub-query to the main query - so for example:

issueFunction in issuesInEpics("labels in (UC-3,UC4,UC-6)")

^ This is searching for all issues in Epics which have one of these labels attached. The part in bold is the sub-query, it is limiting the results to any issues which are children of Epics, where an Epic has one of those UC labels.

----------------------

There are a few alternatives without an app.

Epic Link:

If a UC has a 1-to-1 relationship with an Epic, I would just use the Epic's issue key to perform the search:

"Epic Link" in (ABC-1, ABC-2)

Linked Issues:

If a UC can be associated with multiple Epics, there is an option using Linked Issues. This is how it would work:

  • Create a new Issue Type - Use Case
  • Create Use Cases as issues
  • Link a Use Case to multiple Epics using Linked Issues

You can then utilise this JQL:

"Epic Link" in linkedIssues("ABC-1") OR "Epic Link" in linkedIssues("ABC-2") OR "Epic Link" in linkedIssues("ABC-3")

^ In this instance, ABC-X are all Use Cases - so if there are 5 Epics linked to ABC-1, it would provide all the children of those 5 Epics based on this query.

You can specify a link type also if needed, for example:

"Epic Link" in linkedIssues("ABC-1","relates to")

----------------------

Linked Issues can be quite flexible, as you could search for issues linked directly to a Use Case also, for example if a Story is linked to a Use Case and has no parent Epic.

If you'd like any assistance setting up either alternative - or have any further queries - let me know :)

Ste

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events