ScriptRunner compare reporter email

AccessHolding July 10, 2018

Hi Community,

I am trying to get the email from a issue with:

issue.getReporter().getEmail()

But unfortunately I received an error "cannot find matching method". I need to compare this email address with several domains, followed by specific actions. I saw the syntax above in older groovy versions. Maybe I am just missing a library?

Best,

Kristian

1 answer

1 accepted

2 votes
Answer accepted
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2018

Hello @AccessHolding

This is happens because method really doesnt exist, use

issue.getReporter().getEmailAddress()

ref
https://docs.atlassian.com/software/jira/docs/api/7.1.2/com/atlassian/jira/user/ApplicationUser.html

AccessHolding July 11, 2018

Hello @Mark Markov,

It works fine.

Do you also know how I can set a static reporter? Currently I receive a string only without a proper relation to the existing user. Screenshot attached. Normally the reporter is set as a link to the person details. But in my case its just a basic string.

 issue.reporterId = ComponentAccessor.getUserManager().getUserByName("Noreply")

Issue.JPG

Thanks for your help Mark,

Best,

Kristian

Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 11, 2018

Try to set reported id instead of ApplicationUser object

 issue.reporterId = ComponentAccessor.getUserManager().getUserByName("Noreply").getId()
AccessHolding July 11, 2018

I received the user databse ID with your script. Anyway it helped me, because I changed getId() to .getKey(). Now its fine. Thanks Mark.

Suggest an answer

Log in or Sign up to answer