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 :
How can i create a IssueEventBundle object ?
Maybe someone has an example with this new method ?
I tried :
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.security.JiraAuthenticationContext 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)) issueEventM.dispatchEvent(eventBundle)
It seems ok (for the part "throw custom event").
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...
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