Forums

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

Finding issues assigned to all members of current user's groups with JQL

Md_ Zahurul Islam May 20, 2021

How can we find issues assigned to all members of current user's groups with JQL?

3 answers

1 vote
Fazila Ashraf
Community Champion
May 20, 2021

Hi @Md_ Zahurul Islam 

I am not sure whether you can do a current user's group which is dynamic. But if you know the group already, you can do something like below:

assignee in membersOf("jira-administrators")

Md_ Zahurul Islam May 20, 2021

Thanks. Actually I want to make a dashboard where everyone can view only the issues that are assigned to his/her groups, not to other groups. So I need a JQL query to make a filter where current user's groups will be got dynamically for membersOf("") function. Otherwise I have to make separate dashboards for different groups.

John Funk
Community Champion
May 21, 2021

Try this: Assignee = currentUser() and assignee in membersOf("jira-administrators")

Like # people like this
0 votes
Ignas Selvestravičius
Contributor
August 3, 2022

I have the same problem. Created the teams in advanced roadmap but cannot filter dynamicaly my team and if I want to filter the teams I have to hand write the whole JQL. It is far more simple to create custom field with radio buttons and create teams so you can select them in basic JQL, not required to hand write every time and it is easier for the users that don't know how to write JQL. 

image.pngimage.png

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

You can't do this directly, no-one has written a JQL clause for "user in groups that a named user is in", probably because it's mostly useless.

The closest you can get is what Fazila said - use the "membersOf" to define which groups you are interested in.

The reason a search for other user groups is useless is that 99.9% of Jira installations have groups that include all the users, so a search for "users who are in the same groups as I am" is always going to return everyone.

Nicolas Bourdages _Ubisoft_ October 21, 2021

We've tried something else in the past with a scripted JQL function and a set of groups meant to identify the user's team. For instance, we had groups like Team-QA, Team-Dev, Team-Designer, and each user belonged to exactly one of these teams. The JQL was used like this: issueFunction in assignedToMyGroup("Team")

The function then checked the current user's groups, found the one that starts with the prefix "Team" and performed the query: assignee in membersOF("Team-Dev").

It worked, but it was a hassle. It takes a lot of overhead to manage groups with about a thousand users and make sure everyone is in the right group and ONLY the right group. Performances were not good. Maintenance was not fun and it broke often. So I wouldn't recommend it.

Better approach: A script listener and a Team custom field. Basically, when there's an update to an issue's assignee, the script updates the Team field according to a mapping, like if the team is Team-Dev, the Team field is set to Dev. Then it's just a simple JQL like "Team = Dev" to get the issues assigned to a member of a specific team. Users can even have a nice dashboard with Rich Filter and use a dynamic filter to pick the team. This can be easily done in Automation too, so it's simpler for project admins to maintain it. 

It's not dynamic since it doesn't auto-detect the user's team, but as long as users are able to select their own team, the results is the same. Either way, there's no magic here, a careful management of the groups is needed for any of this to be useful. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events