The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to access the issue in ScriptRunner custom listener?

Marketa Dvorackova
Contributor
June 9, 2015

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Marc Minten (EVS)
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 Champions.
June 10, 2015

You sould use

event.issue.getId()

or

def myIssue = event.issue
myIssue.getId()
Marketa Dvorackova
Contributor
June 10, 2015

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.