Why cfValues['ENT_NOTIF_ESCALADO'] != null condition doesn't returns false when the customfield has no value?



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



4 answers

1 vote

Non-standard custom fields are not supported, as there's no standard way of retrieving the value from them and parsing it. 

0 vote

Perhaps it's an empty list.

Just use:


and let "groovy truth" do the work.

The result is the same :-(

can you attach a screenshot of the config and include the 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

thanks. What type of field is ENT_NOTIF_ESCALADO ? Is it called like, all upper case?

It is a Database Information customfield as you can see in the screenshot 

It is called ENT_NOTIF_ESCALADO (all upper case)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

99 views 0 6
Read article

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