Going Stellar

Home/JQL reference

JQL function

membersOf() in JQL: syntax and examples

membersOf() expands a group into the list of its members. Use it with IN or NOT IN on a user field to find work for a whole group, or to leave a group out. Teams work too, but only through their team ID.

Syntax

membersOf("group-name")
membersOf(id:<teamId>)
membersOf(id:<groupId>)

Arguments

ArgumentWhat it doesOptional
groupThe group name, quoted if it has special characters. For a team or a group ID, write id: followed by the ID. Team names do not work, only the team ID from the team profile URL.no

Works with

  • Fields: Assignee, Reporter, Voter, Watcher, Creator, custom fields of type User
  • Operators: IN, NOT IN, WAS IN, WAS NOT IN
  • Not with: =, !=, ~, !~, >, >=, <, <=, IS, IS NOT, WAS, WAS NOT, CHANGED

Examples

assignee in membersOf("jira-users-overheat") AND statusCategory != Done AND project = WEB

Open website work held by anyone in the main user group. It ignores whoever is assigned, as long as they are in the group.

Run on Jira Cloud on .

reporter in membersOf("jira-admins-overheat") OR reporter in membersOf("org-admins")

Everything raised by either admin group. Two membersOf() calls joined by OR cover several groups.

Run on Jira Cloud on .

assignee not in membersOf("jira-admins-overheat") AND statusCategory != Done

Unfinished work owned by people outside the admin group, for a hand-over review.

Run on Jira Cloud on .

reporter in membersOf("org-admins") AND created >= startOfWeek("-4w") ORDER BY created DESC

What the org-admins group raised in the last four weeks, newest first.

Run on Jira Cloud on .

assignee in membersOf("jira-users-overheat") AND sprint in openSprints() AND statusCategory != Done

Group workload inside running sprints, to see who still carries unfinished work.

Run on Jira Cloud on .

Pitfalls

  • A wrong group name fails the whole query: "Function 'membersOf' can not generate a list of usernames for group 'no-such-group'; the group does not exist."
  • The function returns a list, so assignee = membersOf("jira-users-overheat") fails with "Operator '=' does not support the list value 'membersOf(jira-users-overheat)' for field 'assignee'." Use IN.
  • If the group has more than 10,000 users the search does not run. Split a huge umbrella group into smaller ones.

Questions and answers

Can membersOf() take a team name?

No. The docs say teams do not work with team names. You must pass the team ID, for example membersOf("id:"), taken from the team profile URL.

Sources

  1. JQL functions (Atlassian Support, Jira Cloud)
  2. JQL fields (Atlassian Support, Jira Cloud)

Markdown version · All JQL pages