Forums

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

[Static type checking] No such property: issue for class java.lang - Even.issue Scriptrunner

Shawn Danisa May 5, 2020

I got stuck with the above error:

I also tried def issue = event.issue and no luck. This is on jira version 7.13.  Please assist

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.MutableIssue


Issue issue = event.issue //Error is on this line

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField2 = customFieldManager.getCustomFieldObjectByName("System")
LazyLoadedOption systemOption = (LazyLoadedOption) issue.getCustomFieldValue(customField2)

def changeHolder = new DefaultIssueChangeHolder();
def customField4 = customFieldManager.getCustomFieldObjects(issue).find {it.name == "Aquarius Category"}

if (systemOption?.getValue() == "CMS2") {
customField4.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField4), ""),changeHolder)
}

 

1 answer

1 accepted

0 votes
Answer accepted
Lasse Langhorn
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.
May 5, 2020

Hi @Shawn Danisa

Assuming you are creating an event listener via Scriptrunner you should notice which Jira event you are listening for your script.

It sounds to me that your event listener is listening to an event that is not related to a Jira issue.

Please read more about Scriptrunner listeners

Regards

Lasse Langhorn

Suggest an answer

Log in or Sign up to answer