How to access the issue in ScriptRunner custom listener?

Hi guys,

I am trying to implement a custom listener with ScriptRunner and I am not able to get to the issue for which the event I'm listening to fired.

Logging with

log.debug "Event: ${event.getEventTypeId()} fired for ${event.issue} and caught by MyListener"

I get the right info. The issue object, as I understand from documentation, should be accessible without declaring it. But even if I try a simple

log.debug issue.getId()

it gives me the following error in the log

'java.lang.RuntimeException: No such property: issue for class: com.custom.MyListener'

I can't figure out what I'm missing. Does someone have an idea please?

Thanks a lot

1 answer

1 accepted

You sould use

event.issue.getId()

or

def myIssue = event.issue
myIssue.getId()

Thanks Marc. I had tried that before, but it gave me an error. Something like "trying to access internal protected parameter". I guess I had something else wrong in the code. Works like a charm.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,319 views 14 20
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot