The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello
Scriptrunner version 6.49
In my listener I am getting issue like this:
import com.atlassian.jira.issue.Issue;
def thisIssue = event.issue as MutableIssue
I am shown a static error like this
[Static type checking] - No such property: issue for class: com.atlassian.jira.event.AbstractEvent @ line 31, column 96.
Can you please let me know what is best way to get current issue in event listener.
Thanks
Abe
Generally, you can ignore the static type checking error. Groovy can't know before run time that the event is an IssueEvent, so it can't determine that there is an issue property.
BTW - I don't see that error in my version of ScriptRunner. However, if you want to clear up that error, you can do this:
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.issue.MutableIssue;
def thisIssue = ((IssueEvent)event).getIssue() as MutableIssue
As a general practice, you are better off using the getter/setter functions than accessing the properties of an object directly.
I am getting this static error now
[Static type checking] The variable [event] is undeclared.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.