How do I get Issue Key from event.issue?

Colin Mack Nair April 19, 2019

Hello,

I'm using a script listener to make updates to a custom field on an Issue Update event. In order to do this I need the specific key to the issue from the event. I looked at documentation for event.issue. but don't see anything that says "key" or "id". What can I do here?

3 answers

0 votes
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2019

I use event.issue.key 

event is an instance of IssueEvent

event.issue returns an issue object 

And event.issue,key is a groovy shortcut for event.issue.getKey()

0 votes
Ed Gaile _Atlanta_ GA_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2019

Colin -

When you say using a script listener are you meaning you are using an app like scriptrunner or power scripts to perform this?

If scriptrunner you should be able to use something like:

issue.getKey()

if Power Scripts you could use something like:

string[] fields;
fields = getIssueFields(key);

-Ed

0 votes
Mikhail Ershov April 19, 2019

If you are using Script runner it should be

event.issue.key

Mike

Suggest an answer

Log in or Sign up to answer