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

ScriptRunner REST Endpoint: Can't trigger events Edited

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 = (IssueEventBundleFactoryComponentAccessor.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)

1 answer

1 accepted

0 votes
Answer accepted

For anyone that runs into the same problem I never did figure out how to generate events directly from the ScriptRunner REST Endpoint.

However since my use case involved performing a transition on an issue I could add another post function to run a custom script which generated the event. Which is strange that it works because the post function immediately before my custom script is supposed to throw an event anyway...

Suggest an answer

Log in or Sign up to answer
TAGS

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