Groovy Clone issue script not working correctly

Anthony Hawkins November 5, 2013
Currently, when trying to use the "Clone Issue and project" built-in script that comes with Jira out the box, I get the following error:2013-11-05 12:11:24,264 http-bio-8082-exec-18 ERROR ahawkins 731x23568x1 ykvqyg 143.242.72.185 /secure/CommentAssignIssue.jspa [onresolve.jira.groovy.GroovyFunctionPlugin] Error executing post-functionjavax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: issueInputParameters for class: Script19at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)at javax.script.AbstractScriptEngine.eval(Unknown Source)at javax.script.ScriptEngine$eval$1.call(Unknown Source)at com.onresolve.jira.groovy.canned.utils.ConditionUtils.doAdditional(ConditionUtils.groovy:104)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:43)at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:88)The piece of Groovy code that I used to was the following in the "additional issue action" field:def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Deliverable'} issueInputParameters.addCustomFieldValue(cf.id, 'Characterization')where the custom field name is Deliverable and the value of that field needs to be set to Characterization.

1 answer

2 votes
Daniel Wong April 10, 2014

Seems like you are trying to set a custom field value after cloning the issue.

Try using this in the "Additional Code" part of the post function:

def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Deliverable'}

issue.setCustomFieldValue(cf, 'Characterization')

issueInputParameters doesn't always work.

Make sure the value you're setting matches the custom field type

Suggest an answer

Log in or Sign up to answer