Hi,
I've writen a Bultin Script Listener "Send a custom email". In this listener I've included the condition:
cfValues['ENT_NOTIF_ESCALADO'] != null
The customfield ENT_NOTIF_ESCALADO is the customfield used in the field: "To issue field". The content of this customfield is the list of email addresses to send in the email (i.e: person1@xxx.es, person2@xxx.es, person3@xxx.com). The idea is not to send the email in case of the list was empty.
I've tested the listener with an issue on which the customfield ENT_NOTIF_ESCALADO has value and the result is ok, in the preview it is shown to me that the result of the condition is true.
However, when I test the same listener using an issue on which the customfield ENT_NOTIF_ESCALADO has no value, the result is:
java.lang.NullPointerException: Cannot invoke method split() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:32)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail.getAddressesFromFields(SendCustomEmail.groovy:507)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail$getAddressesFromFields.callCurrent(Unknown Source)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail.getAllToAddresses(SendCustomEmail.groovy:438)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail$getAllToAddresses.callCurrent(Unknown Source)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail.getDescription(SendCustomEmail.groovy:575)
at com.onresolve.jira.groovy.canned.CannedScript$getDescription.call(Unknown Source)
at com.onresolve.jira.groovy.CannedScriptListener.getCannedScriptHumanDesc(CannedScriptListener.groovy:121)
at com.onresolve.jira.groovy.CannedScriptListener$getCannedScriptHumanDesc.callCurrent(Unknown Source)
at com.onresolve.jira.groovy.CannedScriptRunner.doExecute(CannedScriptRunner.groovy:210)
at com.onresolve.jira.groovy.CannedScriptListener.super$6$doExecute(CannedScriptListener.groovy)
at sun.reflect.GeneratedMethodAccessor1188.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 groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:148)
at com.onresolve.jira.groovy.CannedScriptListener.doExecute(CannedScriptListener.groovy:33)
at webwork.action.ActionSupport.execute(ActionSupport.java:165)
at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:87)
at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:39)
at webwork.interceptor.NestedInterceptorChain.proceed(NestedInterceptorChain.java:31)
at webwork.interceptor.ChainedInterceptor.intercept(ChainedInterceptor.java:16)
at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:35)
at webwork.dispatcher.GenericDispatcher.executeAction(GenericDispatcher.java:225)
NOTE: I've tried to use also the conditions:
- cfValues['ENT_NOTIF_ESCALADO'] != null
- cfValues['ENT_NOTIF_ESCALADO'] != ""
The result is always the same.
Any idea?
Thanks in advance
Begoña