Groovy script in script runner

I'm trying to get users not in the jira-users group with email addresses not equal to: email@email.com. I can get the users not in the jira-users group(see below) but not sure how to complete the if statement to show "users email address not equal to email@email.com. I tried user.getEmail but that didn't work for me. i'm sure it's due to me not adding it correctly. Would someone please direct me to a resource that might assist with this..


for ( user in crowdService.search(query) ) {
if (!crowdService.isUserMemberOfGroup(user.getName(), "jira-users")) {
body = body + user.getName() + "\n"
}
}

Thanks.

1 answer

1 accepted

0 votes
Accepted answer

This is the answer:

for ( user in crowdService.search(query) ) {
if (!crowdService.isUserMemberOfGroup(user.getName(), "jira-users")) {
if (!user.getEmailAddress().contains (email@email.com)) {
body = body + user.getName() + user.getEmailAddress() + "\n"
}
}

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,242 views 0 8
Read article

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