jira cloud - I am using script runner cloud and using script post function feature to create a subtask after a transition based on check custom field value. I am not sure what to add in the condition in the script context. Still learn scripting so am a little week. This is how far i got :
// 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 == 'field name'