Get group members in JIRA

Hi All,

I'd like to ask for you help. We need to add 100+ members from more groups to another group. But in the Edit members section we cannot export the members list (I mean simply a Copy (CTRL+C). Do you know a Groovy runner script I can list all the members with, what I can copy then?

Thanks in advance!

Rumi

4 answers

1 accepted

3 votes
import com.atlassian.jira.ComponentManager

def componentManager = ComponentManager.instance
componentManager.getUserUtil().getGroup("jira-users").getUsers()

Hi Jamie,

it works!

Thank you

Hi Jamie,

from the above code, how to give the customized group names instead hard coded "jira-users"

It works for me:

import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.component.ComponentAccessor

def userManager = ComponentAccessor.getUserManager()
def groupManager = ComponentAccessor.getGroupManager()
def group = userManager.getGroup("jira-users")
Collection<User> usersInGroup = groupManager.getUsersInGroup(group)
for (User user : usersInGroup){
	//
}

It doesn't work.

Why? I just had to add the typecast: Collection<User> userList = (Collection<User>) groupManager.getUsersInGroup(group)

Do you have something like this for Python?

Hi,

 

I have a question. I want to write group membership write user picker custom field. When I create issue, group picker custom field set group name (A,B,C etc.) . I want to write that group picker custom field value's (Group A or B,C etc. membership)  another multi user picker custom field. It is possible ?

If I understand you. You want to get all the users from the groups in the first CF, then update a user CF with them? Yes you can do that, just get the user objects from groups, then set the multi user CF to that value.

Hi Jamie,

Firstly , when issue create A Custom Field (Type=Group Custom Field) set group name. (X,Y,Z etc.) Then i want to  according to A Custom Field group value (X,Y,Z etc.)  write groups membership other custom field (multi user picer)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

816 views 2 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you