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

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 vote

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

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
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 Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

181 views 0 4
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