Complex board filter (several projects)
Asked by Liam Kirchner:

Hi I'm trying to to achieve a board filter for the following scenario, but my Jira Admin told me it wouldn't work.

Filter requirements:

* Filter is employed at board level.
* Filter selects tickets from project A and project B (Story, Epic and for project A also Initiatives) that:
  * Are an Initiative themselves OR
  * Are linked to an Initiative OR
  * Are subordinate to an Intitiative i.e. either a subordinate Epic of an Intitiative or the children of a subordinate Epic.

Team A working in project A frequently uses Epics to organize their tickets. There are, however, still a lot of smaller tasks only reflected in a Story.

Team B working in project B rarely uses Epics because they often have small-sized tasks.

Team A and B often work on different aspects of the same larger project, which is why the initiative level was created. The management wants an overview over all larger projects for prioritization and ressource allocation. At the same time I am trying to make the smallest change possible to the existing workflow in Team A and Team B.

Due to the workflow in Team A and Team B, issues will be linked to initiatives in the following ways:

* Epics as subordinates
* Storys will be linked to Epics that are linked to Initiatives as subordinates
* Storys without Epics will just be linked to an intitiative using Jiras linking feature.

Within the board there is a quick filter, allowing me to limit what issue types I want to look at.

Any ideas how to achieve a filter like that?

Many thanks in advance!

Best Liam


Answers:
author: Trudy Claspill
body: Hello [@Liam Kirchner](/t5/user/viewprofilepage/user-id/5542391)

Welcome to the Atlassian community.

I'm am a bit confused about your filter requirements.
> - Filter selects all tickets regardless of hierarchy level from project A and project B (Story, Epic and for project A also Initiatives).
>
> - The filter selects only tickets from project A that are of the type initiative or a child an nth-degree child of an initiative.
>
> The filter selects only tickets from project B that are linked to any initiative in project A.

Elements of the first and second statements appear to contradict each other:
> all tickets regardless of hierarchy level from project A
>
> only tickets from project A that are of the type initiative

These statements of the first and second bullets also appear contradictory:
> all tickets regardless of hierarchy level from ... project B (Story, Epic
>
> only tickets from project B that are linked to any initiative in project A

Can you clarify what you mean by this statement? Perhaps it would be more clear if you provided an example.
> or a child an nth-degree child of an initiative.

Concerning this statement:
> only tickets from project B that are linked to any initiative in project A

...are you talking about issue linked to initiatives using the generic issue linking feature, or are you talking about issues in project B that are children of Initiatives in project A?

comments: author: Liam Kirchner
body: I edited my intial request to be more precise. The contradictions should now be resolved.

Thank you for pointing it out.


author: Trudy Claspill
body: Is it correct to say you want all issues of any type from Project A? Or is there an issue type you don't want from Project A?

Does it matter whether or not the issues from Project A are direct or indirect subordinates of an Initiative? Do you want Story issues that are not connected to Initiatives through being a child of an Epic that is a child of an Initiative?

I ask because of this statement you made:
> Team A working in project A frequently uses Epics to organize their tickets. ++There are, however, still a lot of smaller tasks only reflected in a Story++.

You can easily get all issues from Project A by using the simple filter:

Project = "Project A"

Difficulty arises if you want only Initiatives and their subordinates plus Story issues that are directly linked to Initiatives (i.e. exclude Story issues and Epics that are not associated with Initiatives in one way or another).

Natively there is a [linkedIssues() function](https://support.atlassian.com/jira-software-cloud/docs/jql-functions/#linkedIssues--), but you can get the linked issues for only one issue at a time and you have to provide the issue key for that issue. Natively Jira does not provide a method for you to embed a filter within that function, so you can't do something like:

issue in linkedIssues("project='Project A' and issuetype=Initiative")

...to get all the issues linked to any Initiative in Project A. That is where a third party app is needed.

Otherwise you would have to construct a filter like:

Project="Project A" or (issue in linkedIssues("PROJECTA-001") OR issue in linkedIssues("PROJECTA-002") OR issue in linkedIssues("PROJECTA-003")...)

...where you add a linkedIssues function for each an every Initiative in Project A.

And if you further want to exclude issues from Project A that are not connected in one way or another to an Initiative, that adds additional difficulty. There is a [portfolioChildIssuesOf()](https://support.atlassian.com/jira-software-cloud/docs/search-for-advanced-roadmaps-custom-fields-in-jql/#Child-issues) function, but again you have to explicitly identify the issue for which you want to get all the subordinates.


author: Liam Kirchner
body: > Is it correct to say you want all issues of any type from Project A? Or is there an issue type you don't want from Project A?

Yes, I want issues of any type. I just dont want issues that aren't in any way or form linked or related to an initiative or an initiative themselves.
> Does it matter whether or not the issues from Project A are direct or indirect subordinates of an Initiative? Do you want Story issues that are not connected to Initiatives through being a child of an Epic that is a child of an Initiative?

It doesn't matter whether or not issues from Project A are direct or indirect subordinates to Initiatives. The must be descendants of an Initiative, order not important. Because of the hierarchy we have defined, only Epics can be linked to Initiatives as subordinates. Therefore for all the stories not linked to an Epic we decided to link them directly to the initiative via Jira's generic linking feature.

Seems like there is no other way than to use a third party app like ScriptRunner.

Thank you very much for your help! Much appreciated!


author: Dave Mathijs
body: Hi [@Liam Kirchner](/t5/user/viewprofilepage/user-id/5542391) welcome to the Atlassian Community!

Try this JQL:

`(project = A AND (issuetype = Initiative OR issueFunction in linkedIssuesOf("project = A AND issuetype = Initiative")))`  

`OR`

`(project = B AND issueFunction in linkedIssuesOf("project = A AND issuetype = Initiative"))`  

Part 1 selects all Initiatives in Project A and any issues that are linked to these Initiatives. You might need to adjust this based on how your links are structured to capture nth-degree children.

Part 2 selects all issues in Project B that are linked to any Initiative in Project A.

comments: author: Trudy Claspill
body: Just a note...

"issueFunction in linkedIssuesOf()" is not a native Jira JQL option. That requires addition of a third party app, such as ScriptRunner from Adaptavist.


author: Liam Kirchner
body: [@Dave Mathijs](/t5/user/viewprofilepage/user-id/2662590) thank you very much. As [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) noted, those are not native Jira options. I will see if I can convince my Jira Admins to buy those add-ons though. Quite useful. For now I will have to work work with the native options, however :(


Tags: cloud

jira-cloud