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

How to throw a custom issue event from a post function script (Jira 7) ?

Dupont Dupont Feb 04, 2016



I want to throw a custom event from a post function with a groovy / script runner script in a JIRA 7 platform.

For example :

If customfield xxx has value A -> throw custom event A (to notify group A)

if customfield xxx has value B -> throw custom event B (to notify group B)



I want to use the IssueEventManager :


The old method was simple but is deprecated since 6.4.10 :

dispatchEvent(Long eventTypeId, Issue issue, ApplicationUser remoteUser, boolean sendMail)


Now the only way is to use :

dispatchEvent(IssueEventBundle issueEventBundle)


How can i create a IssueEventBundle object ?

Maybe someone has an example with this new method ?



2 answers

1 accepted

1 vote
Answer accepted
Dupont Dupont Feb 04, 2016

I tried :

  • Create custom events (create issue template)
  • Add them to the notification scheme
  • Use this script (post function create transition in my case) :

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

Long EVENT_ID = new Long("10000")
ApplicationUser currentUser
IssueEventBundle eventBundle

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

currentUser = jiraAuthContext.getUser()
eventBundle = issueEventFactory.wrapInBundle(new IssueEvent (issue, null, currentUser, EVENT_ID, true))

It seems ok (for the part "throw custom event").

0 votes
Thanos Batagiannis [Adaptavist] Community Leader Feb 04, 2016

Hi Dupont,

Maybe this older AA may give you a hint How to Throw a Custom Issue Event from a Custom Listener (it makes use of the issueEventBundle)

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Off-topic

Disney Live Action Reboots: Are you for or against?

Happy Friday Everyone! Today marks the international release of Disney's live action version of the animated classic Aladdin. I know that this movie was met with some controversy of over cast...

137 views 19 8
Join discussion

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