I would like to send a custom email from a workflow post function (using Script Runner), but first I have been using the "Builtin Scripts" in JIRA Administration to experiment.
When I preview various email configurations, the condition correctly evaluates to true, and the email is displayed correctly, but when I try to actually run the email, I get a GroovyCastException (details below). This seems to happen no matter what issue and/or settings I provide.
I've searched this site, as well as Google, and haven't come across a solution. Has anyone seen this, and been able to resolve it?
---
JIRA Version: 5.2.4
Script Runner Version: 2.1.3
Email Details:
- Condition: [issue.priority?.name == 'NA']
- Email Template: [Hello World]
- Subject Template: [Hello World]
- Email Format: [Plain Text]
- To Addresses: (my email address)
- Include Attachments: [None]
- From email address: (empty - shows proper email address in tooltip)
- Preview Issue Key: [DGS-128] (issue exists, and has priority properly set to NA)
Result:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.atlassian.jira.event.issue.IssueEvent@6181836a[issue=DGS-128,comment=<null>,worklog=<null>,changelog=[GenericEntity:ChangeGroup][id,16044][author,mhowell][created,2013-04-24 13:01:16.737][issue,12395],eventTypeId=1,sendMail=false,params={},subtasksUpdated=false]' with class 'java.lang.String' to class 'com.atlassian.jira.event.issue.IssueEvent'
Stack Trace:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.atlassian.jira.event.issue.IssueEvent@6181836a[issue=DGS-128,comment=<null>,worklog=<null>,changelog=[GenericEntity:ChangeGroup][id,16044][author,mhowell][created,2013-04-24 13:01:16.737][issue,12395],eventTypeId=1,sendMail=false,params={},subtasksUpdated=false]' with class 'java.lang.String' to class 'com.atlassian.jira.event.issue.IssueEvent'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
...