We require information from outside systems in our JIRA and Service Desk issues. The following script works fine:
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.ContentType.*
import groovyx.net.http.ContentType
import static groovyx.net.http.Method.*
import groovy.json.JsonSlurper
import net.sf.json.groovy.JsonSlurper
def http = new HTTPBuilder('http://example.com/api/product/' + getCustomFieldValue("Product ID"))
http.request(GET) {
requestContentType = ContentType.JSON
response.success = { res, JSON ->
return JSON.ProductWarrantyStatus
}
response.failure = { res ->
return "Error: ${res.status}"
}
}
However our needs from this system are growing and we need to make multiple requests this way; it is slowing each page load down noticeably, and each scripted field that I add slows it down even more.
How can I make these fields asynchronous, so that the requests load AFTER the JIRA issue details page loads?
Since the scripted field are calculated server-side before the web-client receives the issue object, I don't think that what you are asking can be done. No data is ever stored in the db.
To load field value asynchronously while the user is working on the issue would need to all happen on the client-side.
You may want to re-think your integration. Instead, I would recommend having regular custom fields and use scriptrunner to update the stored value for the fields.
Ideally, your other system would take care of pushing those updates to Jira just when that data changes.
But if that's not possible, you would have to either update the issues in the background on a schedule or using a manual trigger from the users (think global workflow transition ).
In theory, you could write custom javascript deployed via Scriptrunner Web Fragment that would fetch and update the field when an edit screen is open.
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.