Hi community,
need your help please š
I“m only used to work with A4J and I learned a lot of things with it and feel very safe to get things working with it.
Unfortunately in a new project I cannot work with A4J but have to use Scriptrunner for Jira Server. It feels like I don“t even have an idea on how to start there. (furthermore I know some JS and nodeJS but haven“t ever done groovy). I did the very first examples in the docu (just getting value of a custom field). I guess the coding part itself might not be the biggest problem but I“m kinda overwhelmed with
I already have an example I would like to do:
Given:
When:
Then:
Got that working with A4J --> see screenshot. How could this be done with Scriptrunner? Is that too advanced for a "beginner" like me?
Any help is highly appreciated. Not only for that specific example but also how to get into automating with Scriptrunner.
Thanks in advance.
Best
Stefan
Scriptrunner can do most things automation can do, but you do have to write code in order to do anything very clever with it.
A good starting point is "borrowing" scripts from https://library.adaptavist.com , when the built-in stuff doesn't handle it.
well....not really the answer I was expecting. Of course I checked the tons of links that are provided. But it“s overhelming and (my point of view) not properly designed/documented for beginners.
No offense but "Scriptrunner can do most things automation can do" (I am aware of that. That was one reason for my question) and posting a link doesn“t even try to answer any of my questions I posted.
Best
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm sorry, I understood it as you looking for assurance that SR can do this, and somewhere other than the docs to learn from.
I refer people to the library because it's a good starting point, most of the scripts are short, and single function, making easy to crib bits of them together when you've got a slightly different need.
I'm not going to write a script for you (it would be copy and pastes from the library), but try to explain how you might want to do it, by picking out a couple of bits of your spec and explaining (in a different order).
> When: value of custom field "Number 1" of subtask changes
This is where SR needs you to understand a bit about how Jira works. SR can provide all sorts of functions, extending things that Jira does already - listeners; workflow conditions, triggers, post-functions; mail handlers and so on.
In this case, your field could be changed by create, edit, or transition on the issue. A post-function can work on transition, but only a listener can pick up all three of those "events".
I would start from a simple listener that shows how to update a field on the issue that the listener was triggered by.
The important line in there is "def issue = event.issue" - it gives you a standard issue object for the issue that triggered the listener, but also shows that you have an "event" object which contains the nature of the change
The other one to look at is aimed at working with sub-tasks. This one takes data from the parent issue and updates the sub-tasks, so it's backwards for you, but the call
def parentIssue = event.issue.getParentObject()
will get you the parent issue that you actually want to update.
I know that's only a skim of a single case, but it's a start.
On the question of what to import and what they do, there's no way to know until you start tackling a new script. They're actually importing Java or Jira functionality from the libraries in your install, you might find https://developer.atlassian.com/server/jira/platform/java-apis/ a useful reference.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hahaha....thanks for NOT writing the script for me. This is exactly the way I learn things: Just to get pointed into the right direction and then figuring out the details and the doing.
Thank you so much man š„°ā¤ļøšš¼
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.