Hello, my goal is to get all possible information about the current issue and send it by e-mail.
The only thing I came up with is getting it from REST (similar to the way it is done when calling webhook in the post function)
The code below gives me a json wich I can email.
But I dont like to store a user credentials in a script. Can I somehow execute that REST call with a currently logged in user? The way it is done when calling a webhook (I mean that when I call a webhook in a postfunction it done with a current user credentials).
import groovy.json.JsonSlurper
import org.apache.commons.io.IOUtils
def user = "user"
def password = "passwd"
def urlConnection = new URL("http://jiratest.dom.com/rest/api/2/issue/ISS-56905").openConnection()
urlConnection.setRequestProperty("Authorization", "Basic " + (user + ":" + password).bytes.encodeBase64().toString())
def jsonString = IOUtils.toString(urlConnection.inputStream)
Jira 6.2.4
ScriptRunner 3.0.16