Hello fellow Scriptrunner fans,
I've been using ScriptRunner for over a year now and I've cobbled together the ability to find scripts from these forums or from Adaptavist's script library or from Scriptrunner documentation itself. Basically I'm still a beginner.
I can even modify these scripts now in a basic way to adapt them to what I need done. But now my needs are growing and when I can't find something already pre-written I'm at a loss.
What resources did you use to learn how to create these scripts? Many times there are things in the Adaptavist Script Library and I have no idea why/how they work, they just do. I'd like to learn the how/why. I'm hoping/wishing there is some great ScriptRunner script development book out there that I can read and unlock the mysteries of Grovvy script writing.
For example, I want to build a script that I can use in the script console that takes 1 user that I supply and will add this user to a project role (that I supply) to X number of projects which I supply. I want to learn how to build this myself.
I see things like componentaccessor and all these other Import lines but I have no idea why they are needed, I just import them. I just recently discovered I can use the code editor and hit ctrl-space or ctrl-j and learn about available methods or see the documentation but often times the documentation is difficult to understand. I seem to learn best by seeing functioning code and then tweaking that. I don't know how to translate the code found in the official documentation. Where's my Rosetta stone for this stuff?
For example, from the the latest jira api 8.9.0 I found this;
void addActorsToProjectRole(Collection<String> actors, ProjectRole projectRole, Project project, String actorType, ErrorCollection errorCollection)
Just by the name this sounds real promising for what I want to do. What does this look like in real code in a real groovy script?
Do I replace the blue? What does the blue mean? Do I need to include the blue code? Does Project project need to be there is only 1 project necessary. How do I know how to interpret this?
void addActorsToProjectRole(Collection<String> 'mx45678', <--- user i want to add ProjectRole team contributor, <-- a project role Project TOKE, <-- my project key but i have more String actorType, <--No idea what this is ErrorCollection errorCollection) <-- No idea what this is