I am creating several listeners within my instance which some would benefit from having a shared library of utility functions that I can use in different listeners to avoid code repetition (DRY).
I know that I could create a single script and do what's needed based on the event type, but it will be a big script and I want to keep it simple (KISS).
Is there a way of writing reusable code in the scriptrunner scripts? I know I can define shared constant values, but I am not sure about functions
I would start thinking about a custom plugin with a listener at this point. Scriptrunner is great at what it does but writing your own plugin will help you reuse code.
P.S : you will have to remove and add the listener every time you update the class.
Hello Danyal,
I'm relatively new to plugin development but I'd like to give this a try.
Would you be able to point me to an example custom plugin with a listener that's developed solely for the purpose of reusing existing code? We have several ScriptRunner REST endpoints that share a lot of code.
Many thanks!
Kamran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Searching further led me to this article by Alexey Matveev.
I have just skimmed through it but I feel confident that I should be able to take it from here.
Thanks anyways!
Kamran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.