Hello,
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 :
https://docs.atlassian.com/jira/latest/com/atlassian/jira/event/issue/IssueEventManager.html
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 ?
Thanks
Community moderators have prevented the ability to post new answers.
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").
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.