Not sure why this documentation is so hard to find. I simply want to update a custom field to a value.
This is in Jira Cloud. How can I set the customfield_10121 to the dropdown value of ENV1?
def customFieldName = 'customfield_10100'
def result = get("/rest/api/2/issue/${issue.key}?fields=${customFieldName}")
.header('Content-Type', 'application/json')
.asObject(Map)
def type = result.body.fields[customFieldName].value
if (type == 'New Functionality') {
def setEnvironment = put("/rest/api/2/issue/${issue.key}")
.header("Content-Type", "application/json")
.body([
fields:[
customfield_10121: 'ENV1'
]
])
.asString()
}