In a script listener I get few custom fields not available within the context using the following REST API
def cfReviewerNeededId = "customfield_12853"
def cfServiceTypeId = "customfield_12851"
def cfRequestTypeId = "customfield_12100"
def cfCategoryTypeId = "customfield_12847"
def result = get("/rest/api/2/issue/${issue.key}?fields")
.header('Content-Type', 'application/json')
.asObject(Map)
if (result.status == 200) {
logger.info("Success getting fields")
serviceType = result.body.fields[cfServiceTypeId]?.value
reviewerNeeded = result.body.fields[cfReviewerNeededId]?.value
requestType = result.body.fields[cfRequestTypeId]?.requestType.name
//that's a weird place to put the request type!
categoryType = result.body.fields[cfCategoryTypeId]?.value
} else {
logger.info("Error getting fields")
}
Recently it was taking up to over 10 seconds depending on the time of the day which is a concern.
Is there a faster way? Can I get few select fields and not the entire issue? Will this help?
I could use an example of such to see if this works faster
Thannks!