Hi there, I need help from a real expert in regards to Jira JQL filtering and/or ScriptRunner Extended Search.
What I am looking for is basically a filter that shows results based on:
currently logged in user
the projects he/she usually works on
issues in "To Do" status category
I know how to find the projects like e.g. assignee = currentUser() OR worklogAuthor = currentUser() OR commentedBy = currentUser().
I, of course, also know how to use statusCategory IN ("To Do") or similar.
Now, I am looking for a way to do something with a sub query like:
statusCategory IN ("To Do") AND project IN MyDesiredSubQuery(assignee = currentUser() OR worklogAuthor = currentUser() OR commentedBy = currentUser())
So far I've tried several ways to do it in native JQL and also with ScriptRunner Extended Search using projectMatch() but nothing works.
I am aware that JQL is not intended to deliver results for projects but for issues. Still I want to limit the number of results to just the projects the user usually works on.
In the end, I want to have ONE filter for ONE dashboard that works for all users in the organization and shows open and unhandled issues just for the projects they usually contribute to - not other projects.
How could that be done?
EDIT:
Thank you all for your answers.
projectsWhereUserHasRole() was the key. This actually works for me now:
(
project IN projectsWhereUserHasRole("Member") OR
project IN projectsWhereUserHasRole("Administrator") OR
project IN projectsWhereUserHasRole("Service Desk Team") OR
project IN projectsWhereUserHasRole("Internal")
) AND
statusCategory IN ("To Do") AND
status IN (New, "To Do") AND
assignee IS EMPTY