Hi all,
I am trying to set a custom field value on issue creation via a Scriptrunner post function on a Jira Service Desk Cloud instance.
So far I have tried:
(regionId = the ID of the region custom field)
(nations_json[i]?.region = Value I am trying to set the 'Region' field to)
put("/rest/api/2/issue/${issue.key}")
// .queryString("overrideScreenSecurity", Boolean.TRUE)
.header("Content-Type", "application/json")
.body([
fields[
(regionId): nations_json[i]?.region
]
])
.asString()
log.debug("REGIONFIELD " + customFields.find { it.name == 'Region' })//This returns details about the 'Region' custom field
log.debug("REGIONFIELD " + customFields.find { it.name == 'Region' }?.value) //This returns null
However when I try to return the value stored within the 'Region' custom field, it returns NULL, see log output below:
2020-01-29 13:58:07.001 INFO - Serializing object into 'interface java.util.List'2020-01-29 13:58:07.012 INFO - GET /rest/api/2/field asObject Request Duration: 540ms2020-01-29 13:58:07.344 INFO - Serializing object into 'interface java.util.List'2020-01-29 13:58:07.350 INFO - GET /rest/api/2/field asObject Request Duration: 299ms
2020-01-29 13:58:07.410 DEBUG - REGIONFIELD [id:customfield_10179, key:customfield_10179, name:Region, custom:true, orderable:true, navigable:true, searchable:true, clauseNames:[cf[10179], Region], schema:[type:option, custom:com.atlassian.jira.plugin.system.customfieldtypes:select, customId:10179]]
2020-01-29 13:58:07.412 DEBUG - REGIONFIELD null
2020-01-29 13:58:07.430 INFO - Condition didn't eval to true, exiting
Does anybody know how to correctly set a custom field value?