Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

109 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you