Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Script help

Edited

Hi, 

I want to get a list of all active users with username and email address from a specific group in jira.  Trying to run this scirpt through script Runner console, any suggestions on how to get email address too? i pulled a list with just usernames.

1 answer

0 votes
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 12, 2023

Hi @Spruha Shah 

could you share your code? This would make it easier to analyze the problem.

How do you get the user names? do you only get a list of strings with the names or do you get a list of user objects?

Generally the user object has an email property and you can get this from a user object variable eg. ‚user‘ as follows:

user.getEmailAddress()

 

Best
Stefan

import com.atlassian.jira.component.ComponentAccessor

 

def groupManager = ComponentAccessor.getGroupManager()
def user = User.getEmailAddress()

 

String groupName = "jira-software-users"

 

groupManager.getUsersInGroup(groupName)
user.getEmailAddress(user)
i am trying to get all users that are in 'jira-software-users' not just with username but also with email. 
In our jira, username and email are different for each user.
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 18, 2023 • edited

groupManager.getUsersInGroup

Returns a collection of user objects of the users in the group. If you add a .getEmailAdress() it will return the email of all users.

The following script should do the work:

import com.atlassian.jira.component.ComponentAccessor

 

def groupManager = ComponentAccessor.getGroupManager()

 

String groupName = "jira-software-users"

 

groupManager.getUsersInGroup(groupName).getEmailAddress()
Best
Stefan

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events