Groovy Clone issue script not working correctly

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

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
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

463 views 7 5
Join discussion

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