Yes, the API often changes as versions change.
At a glance, there's nothing that jumps out as being wrong in your script, but I really can't bothered to read it properly without you saying which line might be a problem. I don't see any reason to put in any effort when the computer will tell us where it is faster.
Could you use the built-in script editor? That will tell you where things are wrong in your script.
No, you need to understand them to fix them. A computer can't guess at what you were intending to do in your script.
However, static type checking is something that needs to be done when you use a weakly typed language like Groovy. I personally dislike weakly typed languages because of this sort of woolly thinking they encourage, and I tend to fix most of the ones I cause by swapping to properly declared objects. (instead of "def thing = ", I'll say "int thing = ", so I can rely on knowing what type of object "thing" is later)
There's a less opinionated write up about static object types over at https://scriptrunner.adaptavist.com/latest/jira/#_tips_for_type_checking which includes a lot of information on fixing them.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG