Can I get the issue reporter's email address using the groovy script?

Hello, 

I use the custom field in the script below to print the reporter group at the bottom of the Jira issue.

The script below is not my own, and I do not understand how it works, but it works.

And now I'd like to print the issue reporter's Jira account (or Email) at the bottom of the issue instead of just outputting a group of reporters.

As I expected, it would be possible to modify the script below, but I did not know what to do or what to look for.

Can someone help me?
It will help me a lot.

Thank you. :)

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.getGroupManager()
def reporter = issue.getReporter()
def groupList = groupManager.getGroupsForUser(reporter)

if (groupList == null || groupList.size() == 0) {
return null
}

def valid = groupList.findAll { group ->
}
return valid?valid[0].getName():null

 

2 answers

1 accepted

Wow, I kept trying and I did what I wanted.

It works with the following two lines of script.
thank you! :)

def reporter = issue.getReporter()
return reporter.getName()
def reporter = issue.getReporter()
return reporter.getName()

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 Tuesday 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...

240 views 1 18
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