Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Begoña Bonet
Contributor
October 12, 2015

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

4 answers

1 vote
JamieA
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.
October 13, 2015

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

Begoña Bonet
Contributor
October 13, 2015

Ok, thanks Jamie

0 votes
Begoña Bonet
Contributor
October 13, 2015

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

It is called ENT_NOTIF_ESCALADO (all upper case)

0 votes
Begoña Bonet
Contributor
October 13, 2015

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

JamieA
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.
October 13, 2015

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

0 votes
JamieA
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.
October 12, 2015

Perhaps it's an empty list.

Just use:

cfValues['ENT_NOTIF_ESCALADO']

and let "groovy truth" do the work.

Begoña Bonet
Contributor
October 12, 2015

The result is the same :-(

JamieA
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.
October 13, 2015

can you attach a screenshot of the config and include the versions.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, aafp, jira migration, marketing collaboration, end siloed work, streamline workflows, kerrie gottschalk, jira cloud admins, unified marketing, process visibility, team efficiency, cross-team collaboration

How Kerrie Gottschalk unified AAFP’s marketing team with Jira

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
AUG Leaders

Atlassian Community Events