Hi,
I am trying to create a script runner listener to read from cascading select field. I am using Jira 6.2.7 and Script runner 2.1.17. I have created a test project (TP) with field name "Cascading Select" and used example provided in this link https://studio.plugins.atlassian.com/browse/GRV-42
However I am getting below error when I run the script in script console. Any idea what is wrong in my case?
Thanks for your help!!
Rama
Here is the my script
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.view.CustomFieldParams
import com.atlassian.jira.issue.fields.CustomField
ComponentManager componentManager = ComponentManager.getInstance()
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()
MutableIssue issue = componentManager.getIssueManager().getIssueObject('TP-7')
CustomField cf = customFieldManager.getCustomFieldObjectByName("Cascading Select")
CustomFieldParams cfVal = issue.getCustomFieldValue(cf) as CustomFieldParams
if (cfVal) {
Collection values = cfVal.getAllValues()
String first = values[0]
String second = values[1]
log.debug("First - second: $first - $second")
}
else {
log.debug("Custom field not present on this issue")
}
Here is the error
Caused by: javax.script.ScriptException: java.lang.UnsupportedOperationException at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:318) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111) ... 178 more Caused by: java.lang.UnsupportedOperationException at org.codehaus.groovy.runtime.ConvertedMap.invokeCustom(ConvertedMap.java:49) at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:82) at com.sun.proxy.$Proxy2888.getAllValues(Unknown Source) at com.atlassian.jira.issue.transport.CollectionParams$getAllValues.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112) at Script1.run(Script1.groovy:16) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:315) ... 179 more
I've updated the example code in that issue to make it work on 6.x:
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.