I have a ScriptRunner Rest Endpoint which upon receiving a response will add a comment and transition an issue. I would expect these actions to generate events like Issue Commented or Generic Event which should be picked up by the ScriptRunner Listeners. When I perform the same actions in the ScriptRunner Console I can see that my listeners do in fact run as expected. However nothing I do in the REST Endpoint can cause a Listener to run. Is there something I am missing or another way to accomplish what I need?
Here is an example function I used to try to generate an event, it works in Script Console but doesn't appear to in the REST Endpoint.
def dispatchGenericEvent(MutableIssue issue){
IssueEventManager issueEventManager = ComponentAccessor.getIssueEventManager() IssueEventBundleFactory issueEventFactory = (IssueEventBundleFactory) ComponentAccessor.getComponent(IssueEventBundleFactory.class)
IssueEventBundle eventBundle = issueEventFactory.wrapInBundle(new IssueEvent(issue, null, botUser, EventType.ISSUE_GENERICEVENT_ID, true)) issueEventManager.dispatchEvent(eventBundle)
}
MutableIssue issue = issueManager.getIssueObject("HELPDESK-20092")
dispatchGenericEvent(issue)