Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Someone knows if you can throw an event with script runner and process mails with Email this Issue


I need to throw an event with script listener on an issue updated event. Then afterwards, the event should be processed by Email this Issue with a given Template. In Email this Issue I already uploaded a template, notification and a context for this event.

I tried everything to throw an event but no mail gets sent and I don't know why nor can I figure out why in logs. I tried following code already to throw an event:

First try:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption;

def aGroupChanged = event.changeLog.getRelated("ChildChangeItem").find { it.field == "aGroup" }

if (aGroupChanged) {"(" + event.issue.key + ") E-Mail gets sent")
ComponentAccessor.issueEventManager.dispatchEvent(10100L, event.issue, event.user, true)

Since this method is deprecated i tried something else, which I found in the community and modified it a bit:

import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.event.issue.IssueEventBundle
import com.atlassian.jira.event.issue.IssueEventManager
import com.atlassian.jira.event.issue.IssueEventBundleFactory
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.type.EventDispatchOption;
import org.apache.log4j.Category;

Long EVENT_ID = new Long("10100")
ApplicationUser currentUser
IssueEventBundle eventBundle
def aGroupChanged = event.changeLog.getRelated("ChildChangeItem").find { it.field == "aGroup" }

JiraAuthenticationContext jiraAuthContext = ComponentAccessor.getJiraAuthenticationContext()
IssueEventManager issueEventM = ComponentAccessor.getIssueEventManager()
IssueEventBundleFactory issueEventFactory = (IssueEventBundleFactory) ComponentAccessor.getComponent(IssueEventBundleFactory.class)

currentUser = jiraAuthContext.getLoggedInUser()
eventBundle = issueEventFactory.wrapInBundle(new IssueEvent (event.issue, null, currentUser, EVENT_ID))

if (aGroupChanged) {
issueEventM.dispatchEvent(eventBundle)"Issue: " + event.issue.key + " E-Mail sent");
} else if (!aGroupChanged) {"Issue: " + event.issue.key + " ERROR");

Some advices? Since I don't script or code very much I don't know what to do next, especially in the 2nd try, which is too complicated already for me. Thanks in advance

0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events