// The issue key
def issueKey = 'YourIssueKey'
// Fetch the issue object from the key
def issue = get("/rest/api/2/issue/${issueKey}")
.header('Content-Type', 'application/json')
.asObject(Map)
.body
// Get all the fields from the issue as a Map
def fields = issue.fields as Map
// Get the Custom field to get the option value from
def customField = get("/rest/api/2/field")
.asObject(List)
.body
.find {
(it as Map).name == 'Request participants'
} as Map
// Extract and store the option from the request Participants
def values = fields[customField.id] as List<Map>
// Get each of the values (accountId) from the request participants
def fieldValues = values.collect {
it.accountId
}
if (values){
return values //return all the Request Participants
}else{
return false //if the field is empty
}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.