How to programmatically register a Service?

Max Berger October 17, 2019

I recently saw this question somewhere but now I cannot find it anymore, so please bear with me.

I have a ScriptRunner Script that will execute REST-calls against a backend. Now I possibly need a single call to be repeated, e.g. because the connection attempt failed. For this, I'd like to register a service to be executed at a single time (preferably once, but I suppose if I can register it, I can also de-register it). Preferably I'd also like to be able to pass parameters to that Service, namely the IssueEvent that triggered the script in the first place. Thus, I have the following questions:

  • How can I programmatically, from inside a Groovy script executed by a Listener, register a Service?
  • Can I pass arguments to this Service, so it has access to a specific IssueEvent?

I could solve this by registering a new custom-field and modifying it in case a script fails, but this will put me in a situation where I cannot determine certain parameters I need. The best solution would be to have a Service that receives the very same IssueEvent and especially its changelog.

Thank you in advance :)

0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events