Hey everyone,
Since the Adaptavist forum seems kind of dead and most Google searches end up in this forum anyways, I am trying my luck here.
We have tons of inline groovy scripts in our workflows: validators, post-functions, etc.
(Jira DC 9.x, not Cloud)
In the admin UI of ScriptRunner, it allows to create a folder structure and create groovy scripts there.
In validators etc. it allows for inline script OR referencing a file from said folder structure.
Now here is my issue / question:
In workflow, I do have access to certain bindings, e.g. issue, cfValues and such.
How do I use the file reference and be able to access those bindings there?
The same bindings aren't readily available in the standalone scripts. Obviously they don't know the context they will be run in.
I find it odd that I couldn't find documentation for this use-case. Why would I take a validator from a file if said validator has no clue about the issue as a context? This seems to massively limit the usefulness.
Or do I have to some weird stuff like have an inline script which imports the file, calls a function and passes the bindings over to the script? I didn't even find documentation for that...
There is a "binding" variable readily available. Yet again, no documentation to be found which tells me how the bindings are named. ¯\_(ツ)_/¯
In the end, we want to put the folder under version control and reuse the same validator code in multiple workflows.
Thx.