def issue = event.issue as issue in groovy. error

Meena Sabnivisu April 9, 2018

def issue = event.issue as issue in groovy. A error saying event is not declared for class is coming. I dont know what the problem is. I am trying to get the current issue key which is created after create issue event.

1 answer

1 vote
Steven F Behnke
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.
April 9, 2018

You need to tag your question with scriptrunner if you expect the vendor to help. 

You're trying to cast 'event.issue' as an Issue but you haven't imported the Issue class. So the error is obvious. 

Add

import com.atlassian.jira.issue.Issue 

to the top of your script and it will no longer cause an issue.

SWAPNIL SRIVASTAV November 19, 2020

Hello @Meena Sabnivisu and @Steven F Behnke ,

I am facing the same error even though I have imported Issue Class. Please let me know how to fix it. script runner version: 6.5.0. Jira version: 8.5.0

Gaurav Arora April 7, 2021

@SWAPNIL SRIVASTAV  - please share your code.

Suggest an answer

Log in or Sign up to answer