I am not good for Scriptrunner,but need to use it urgently to solve problems.
Can someone give an example for the problem as this:
How to do to get the current issue' ID ?
how to do to get the current issue's workflow translate and node status ?
how to do to get the current issue's sub-issue or parent-issue ?
how to do to get the current issue's field's value and change it.
and so on .
I know the links of learn scriptrunner, but unfortunately, I didn't have much time to get acquainted with it
thanks very much!
So most of your questions are out of context, all we can really say is "where"?
For example, when you ask
Where do I get the current issue ID?
The answer depends on where you are running the code. In the console, listeners, email handlers and so-on, current issue id could be anything, it depends on what you're coding for. In post-functions, it's easy, the context contains simply "issue", which is the issue object for which you're running the transition (and you probably don't even care what the issue ID is, because "issue" contains the entire issue already, so you can use it directly and not need to look anything up)
For a listener, "current issue" probably means "the issue for which this event was fired", and you can get the issue object from event.issue, but some events happen without an issue.
Now, assuming you have worked out what issue you are working with, the answers to the others within that context are:
issue.getStatus()
issue.getSubTaskObjects()
issue.getParentObject()
Customfields are a bit more complex, start with a look in https://library.adaptavist.com/entity/update-the-value-of-custom-fields-through-the-script-console
And do feel free to rummage through that library for more scripts
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.