Script runner reading cascading field


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

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!!


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( at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval( ... 178 more Caused by: java.lang.UnsupportedOperationException at org.codehaus.groovy.runtime.ConvertedMap.invokeCustom( at org.codehaus.groovy.runtime.ConversionHandler.invoke( at com.sun.proxy.$Proxy2888.getAllValues(Unknown Source) at com.atlassian.jira.issue.transport.CollectionParams$ Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall( at at at at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval( ... 179 more

1 answer

1 accepted

Thanks Jamie! It worked! Appreciate your help!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

110 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you