Email notifications are not received with custom listener defined

Hi all,


For one of the requirements that we have at the moment , custom listener from the script runner will be an option

The following listener that I used , is working fine .However email notifications are not sent for any updates.


Custom Listener on script runner.JPG


void issueUpdated(IssueEvent event)

Issue issue = event.getIssue()
if (issue.getIssueType()== "EPIC" )
List changeItems = event.getChangeLog().getRelated("changeItem")
if( changeItems.any {it.get('field')=='Fix Version/s'} )
def projectManager = issue.getProjectObject().getProjectLead().emailAddress
Email email = new Email( projectManager )
email.setSubject("Ticket ${issue.getParentObject()} Requires Review")
email.setBody("The Fix Version is updated recently for the issue $issue")

SingleMailQueueItem item = new SingleMailQueueItem(email)
try {
} catch (Exception e) {

2 answers

1 accepted

Hi RP,

Assuming you are using the latest version of ScriptRunner you could configure a built-in script listener called "Send a custom email" (rather than write your own).

To configure it:

  • Give it a note like "If Epic and FixVersion changes - send an email"
  • All projects
  • "Issue Updated" event
  • Use this condition
import com.atlassian.jira.component.ComponentAccessor == 'Epic' && changeItems.any {
  • Use this Email Template
The Issue $issue has changed it's FixVersion field 
to: ${issue.fixVersions}
  • Use this Subject Template
Ticket $issue - requires review
  • Choose html for the email format (or text)

I hope that helps.





Thank you very much Mark smile 

custom email template worked perfectly.

Excellent, thanks for letting me know.

Is there a good way to actually send custom emails using custom piece of scripted code? I'd prefer to have my code versioned inside any source control system and to deploy it to production JIRA using CI environment as opposed to having simple JIRA 'send custom email' configuration. There is no way of keeping track of changes to this configuration as long as it has to be manually filled in by human on the JIRA admin pages.

In my case I also need to diversify recipient list based on the actual project. For that purpose custom script listener looks like the best and only option I have.

From the payload , the message is 


"event": "com.atlassian.jira.event.issue.IssueEvent@7f313b61[issue=DPDK-48,comment=<null>,worklog=<null>,changelog=[GenericEntity:ChangeGroup][issue,15510][author,jadmin][created,2016-07-31 19:33:41.958][id,19945],eventTypeId=2,sendMail=true,params={eventsource=action, baseurl=},subtasksUpdated=true]",
    "clazz": "{null/empty} (java.lang.String)",
    "bundle": "com.atlassian.jira.event.issue.DefaultIssueEventBundle@5225d86e",
    "events": "[2, 10200, com.atlassian.jira.issue.fields.event.FixVersionCreatedInline] (java.util.ArrayList)"

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,760 views 11 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot