We are currently experimenting with script runner to roll out a rather large customization of JIRA. The number of behaviors that we are using is getting rather unwieldly and a lot of these scripts are basically carbon copies of each other with a variation on the field name, or another token.
The Behavior's loader for scriptrunner describes that I can pick a Run method if the script being pointed to is a class.
MY ASSUMPTION was that this is meant to work like calling the main method or like the java command line executable.
I tried different syntaxes for calling a method with arguments, but was only able to get it to work with a 0 parameter static void function. Additionally, the FieldBehaviors base class that a basic script has, is not available to the class whether I inherit Field Behaviors or try a Dependency Injection approach through the main class arguments.
There are ways to work around this from an organizational standpoint, but I would like to know if this is a feature that is planned to be implemented or if my understanding is grossly off on this.
Thanks for any help!
I have followed two strategies for similar problems.
where I had a repeating script that only varied by named fields, I wrote the script so all variations were set as constants at the start. This made copy and paste easier but didn’t fix the volume of code.
Ultimately groovy is calling the underlying java classes so you can build a jar file of utility classes and put in the Jira lib directory. I created a library of date manipulation utils to reuse across different scripts.
[removed]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tom Lister,
Thanks for the info. The current solution is to extend base classes with hard-coded values in the extending context for each separate field (much like yours) and use the loaded script functionality.
I still would like to know if this is the intended behavior of the behavior class method input, or if it is a feature that is not at full maturity yet.
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.