Set a select list custom field value
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
- Choose Workflows
- Choose Edit
- choose a transition
- choose post function
- Add a post function
- 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.
Related articles