Cannot set a custom field value for a select list

Problem

User is unable to set a custom field value for a select list.

The code used in a post function was:

import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def textCf = customFieldManager.getCustomFieldObjectByName("customFieldId=10807") 
issue.setCustomFieldValue(textCf, "Training")

Solution

The answer is given in the Atlassian Answer page

You say that your field is a select list (single), but then you treat it as though it is a text field.  A select list expects you to give it an option not a string.

The code snippet I have replaces the last couple of lines in your code:
def cf = customFieldManager.getCustomFieldObjectByName("customFieldId=10807")
def cfConfig = cf.getRelevantConfig(issue)
value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find { it.toString() == 'Training' }
issue.setCustomFieldValue(cf, value)