Groovy postfunction fail in Jira 6.1

Tibor Gulyas January 23, 2014

Hi!

In my JIRA 5.2.6 instance, with ScriptRunner 2.1.11 installed, this groovy postfunction script works correctly:

import com.atlassian.jira.component.ComponentAccessor;
customFieldManager = ComponentAccessor.getCustomFieldManager()
customField = customFieldManager.getCustomFieldObject("customfield_10043")
issue.setCustomFieldValue(customField, issue.getProjectObject().getLead() )

After upgrede to JIRA 6.1, ScriptRunner 2.1.16, not works.

There are no eny messsage in jira log, but the customfield does'nt get value.

When I change the ".getLead()" to .getLeadUserName()", I get this error:

2014-01-24 11:00:12,272 http-bio-8090-exec-5 ERROR ####### 660x9686x1 1ioigp9 172.31.11.95,172.31.11.104 /plugins/servlet/com.onresolve.ScriptedFieldPreviewServlet [onresolve.jira.groovy.GroovyCustomField] javax.script.ScriptException: java.lang.NullPointerException
javax.script.ScriptException: javax.script.ScriptException: java.lang.NullPointerException
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)
        at javax.script.AbstractScriptEngine.eval(Unknown Source)
        at javax.script.ScriptEngine$eval.call(Unknown Source)
        at com.onresolve.jira.groovy.GroovyCustomField.getValueFromIssue(GroovyCustomField.groovy:157)
        at com.atlassian.jira.issue.customfields.CustomFieldType$getValueFromIssue.callCurrent(Unknown Source)
        at com.onresolve.jira.groovy.GroovyCustomField.getRealVelocityParameters(GroovyCustomField.groovy:324)
        at com.onresolve.jira.groovy.GroovyCustomField$getRealVelocityParameters.call(Unknown Source)
        at com.onresolve.jira.groovy.customfield.ScriptedFieldPreviewServlet.doPost(ScriptedFieldPreviewServlet.groovy:86)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)  <+14> (ApplicationFilterChain.java:305) (ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:87) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (XContentTypeOptionsNoSniffFilter.java:22) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (HeaderSanitisingFilter.java:44) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66)

Is there any error in this script?

Regards,

Tib(R)

1 answer

1 accepted

1 vote
Answer accepted
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2014

If the customfield is a user customfield, it now needs an ApplicationUser object. If you use projectObject.getProjectLead() it should work.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events