Hello
In Adaptavist ScriptRunner Behaviour with initializer configured for a script "screen-init.groovy" with method "run",
I receive following exception for each execution:
2019-09-24 14:41:50,119 http-nio-8080-exec-84 ERROR [...] /rest/scriptrunner/behaviours/latest/validators.json [c.o.jira.behaviours.BehaviourManagerImpl] Validation exception.
groovy.lang.MissingPropertyException: No such property: b for class: screen-init
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:66)
at groovy.lang.MetaObjectProtocol$setProperty.call(Unknown Source)
at com.onresolve.jira.behaviours.BehaviourManagerImpl$_runValidator_closure9.doCall(BehaviourManagerImpl.groovy:216)
And I do not understand what is wrong and where this "b" comes from.
Here is the script content:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.project.property.ProjectPropertyService
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def projectId = getIssueContext().getProjectObject().id
def projectPropertyService = ComponentAccessor.getComponent(ProjectPropertyService.class)
def enabledProperty = projectPropertyService.getProperty(user, projectId, "enable-choice")
def firstField = getFieldByName("First")
def secondField = getFieldByName("Second")
if (enabledProperty?.isValid()
&& enabledProperty.getEntityProperty()?.isDefined()
&& "1".equals(enabledProperty.getEntityProperty()?.get()?.getValue())) {
if (secondField) {
secondField.setReadOnly(true)
}
if (firstField) {
firstField.setReadOnly(false)
}
} else {
if (secondField) {
secondField.setReadOnly(false)
}
if (firstField) {
firstField.setReadOnly(true)
}
}
And it seems to me that behaviour executes properly when invoking concerned screen...
So is there a way to get rid of these exceptions in Jira log file?
Thank you in advance for your help