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:
Any idea?
Thanks in advance
Begoña
Non-standard custom fields are not supported, as there's no standard way of retrieving the value from them and parsing it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is a Database Information customfield as you can see in the screenshot
It is called ENT_NOTIF_ESCALADO (all upper case)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Versions:
JIRA 6.1.7
Script runner 2.1.16
Here you have the screenshots with the configuration and the result with:
ENT-17297 on which the ENT_NOTIF_ESCALADO has no value
ENT-17298 on which the ENT_NOTIF_ESCALADO has value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks. What type of field is ENT_NOTIF_ESCALADO ? Is it called like, all upper case?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Perhaps it's an empty list.
Just use:
cfValues['ENT_NOTIF_ESCALADO']
and let "groovy truth" do the work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you attach a screenshot of the config and include the versions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
At the American Academy of Family Physicians, siloed marketing teams faced delays and duplicate work. Kerrie Gottschalk shook things up by moving the department to Jira, streamlining processes, boosting visibility, and sparking stronger collaboration.
Read the story
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.