Can not sent email directed to a custom field of type "mulitple user" select

d.delbecq September 17, 2012

Hello, i have a custom field that allow me to pickup multiple users. When askin to script send en email to this custom field, i get the error bottom. It seems embedded groovy script is using it.email at line 377 instead of it.emailAddress.

I have tried copy / pasting the groovy code in a new groovy file and create a post function the use this new script, but then i loose all configuration capabilities of embeded scripts :/

Am i doing something wrong / is there an easy workaround?

PS: can't find bug tracker of groovy runner, so sorry if it's a know issue.

groovy.lang.MissingPropertyException: No such property: email for class: com.atlassian.crowd.embedded.ofbiz.OfBizUser
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
	at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:63)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
	at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail$_getAddressesFromFields_closure7.doCall(SendCustomEmail.groovy:377)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)
	at groovy.lang.Closure.call(Closure.java:412)
	at groovy.lang.Closure.call(Closure.java:425)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.collect(DefaultGroovyMethods.java:2048)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.collect(DefaultGroovyMethods.java:2018)
	at org.codehaus.groovy.runtime.dgm$78.invoke(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java:82)
	at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail.getAddressesFromFields(SendCustomEmail.groovy:377)
	at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail$getAddressesFromFields.callCurrent(Unknown Source)
	at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail.getAllAddresses(SendCustomEmail.groovy:338)
	at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail$getAllAddresses.callCurrent(Unknown Source)
	at com.onresolve.jira.groovy.canned.workflow.postfunctions.SendCustomEmail.getDescription(SendCustomEmail.groovy:450)
	at com.onresolve.jira.groovy.canned.CannedScript$getDescription.call(Unknown Source)

1 answer

0 votes
Jobin Kuruvilla [Adaptavist]
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.
September 17, 2012

An easy option would be to create an event, add the multi user field into the event and throw the event using the script.

d.delbecq September 17, 2012

unfortunately, we want to use 'send email' post function script because it let us customize the templates. The purpose is to send some very specific informational emails to some users, but those used shouldn't / don't need to know jira is behind this :) (It's basically an email stating "those Xyz informations are needed to solve your problem, please contact operator at number abc" )

I have worked around the problem using documentation section "built-in scripts hacking notes". And it confirms that changing from it.email to it.emailAddress is the solution to the problem :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events