Where can I find ScriptRunner JavaDoc?

I’m trying to add a new Built-in script (so admins can run it from the Built-in Script menu), and from what I’ve found, I need to implement com.onresolve.scriptrunner.canned.CannedScript.

But where can I find the extremely important Java doc for the class? I need to know what methods I need to implement.

There seems to be lots of examples, but they are no replacement for an actual Java doc.

Hey,

I would like to have a good answer for you, but unfortunately I do not at this moment. The CannedScript class is not intended as a public API, in the past examples have been published by Adaptavist making use of it, but it is not something we actively encourage using these days.

That said, we are working on the topic of public ScriptRunner APIs, we do generate Javadoc for such APIs, it’s just not publicly published anywhere right now, we’re going to tackle that in the next month or so.

As CannedScript was never designed for public consumption, the Javadoc that does exist on that class is minimal and not all that helpful, it’s somewhat of an old class and has been superseded by newer methods, which are also not publicly documented.

Cheers,

Reece

3 Likes

Thanks @rlander.

If my goal is to provide a configurable script for admin users to run (for example, to mass reset issue status), how can I implement it using ScriptRunner?

I can add a utility class in Script Editor and tell the admin to write a short script in Console, but that feels not very user friendly, as they will need to provide the parameters somehow.

I could go with a full-blown Jira plugin, but I wonder if I can leverage ScriptRunner for that. That Built-in Script UI looks good, if only I can add items to it.

2 Likes

Thank you for elaborating more on your requirement :slight_smile:

If my goal is to provide a configurable script for admin users to run (for example, to mass reset issue status), how can I implement it using ScriptRunner?

We have a solution for this! Our Dynamic Forms feature allows you to parameterise your scripts with a user interface which is generated from annotations within code (its pretty neat).

You can create scripts in the script editor within a script root making use of Dynamic Forms annotations, when these scripts are then loaded in the Script Console (or any other feature which supports configuration by file) you will see the form rendered from the annotations in your code.

This is a supported API for providing a user interface for configuring scripts, hopefully it helps you achieve your goals.

Cheers!

Reece

1 Like

Thank you very much, I’m definitely trying this out!

1 Like

Success… with the discovery made in this thread (Issue generic get field? - #2 by KCWong), now I have a generic issue data patcher script.

Patching Status is not yet possible, as I have no way to find the action ID to use. I also haven’t done all the data types, but the script is pretty usable already.