Skip to end of metadata
Go to start of metadata

Use a ScriptRunner post function to set a custom field value. The documentation shows how to set a default value for a select list.

Step-by-step guide

  1. Choose Workflows
  2. Choose Edit
  3. choose a transition
  4. choose post function
  5. Add a post function
  6. Use the code below

 

import com.atlassian.jira.component.ComponentAccessor
def cfSelect = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Favourite Fruit")
def cfConfig = selectCf.getRelevantConfig(issue)
def value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find {
    it.toString() == 'Lemons'
}
issue.setCustomFieldValue(cfSelect, value)

Replace "Favourite Fruit" with the actual field name in JIRA.

Replace 'Lemons' with the actual custom field select value.