I would like to use the below script
https://scriptrunner.adaptavist.com/5.2.0/jira/recipes/behaviours/select-list-other.html
[
import com.atlassian.jira.component.ComponentAccessor def customFieldManager = ComponentAccessor.getCustomFieldManager() def optionsManager = ComponentAccessor.getOptionsManager() def faveFruitOtherFld = customFieldManager.getCustomFieldObjectByName("Favourite Fruit (Other)") def issueService = ComponentAccessor.getIssueService() def issue = event.issue def otherFaveFruit = issue.getCustomFieldValue(faveFruitOtherFld) as String if (otherFaveFruit) { def faveFruitFld = customFieldManager.getCustomFieldObjectByName("Favourite Fruit") def fieldConfig = faveFruitFld.getRelevantConfig(issue) def currentOptions = optionsManager.getOptions(fieldConfig) def newSeqId = currentOptions*.sequence.max() - 1 def option = optionsManager.createOption(fieldConfig, null, newSeqId, otherFaveFruit) def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def issueInputParameters = issueService.newIssueInputParameters() issueInputParameters.with { addCustomFieldValue(faveFruitFld.idAsLong, option.optionId.toString()) addCustomFieldValue(faveFruitOtherFld.idAsLong, null) } def updateValidationResult = issueService.validateUpdate(currentUser, issue.id, issueInputParameters) if (updateValidationResult.isValid()) { issueService.update(currentUser, updateValidationResult) } else { log.warn("Failed to update issue: ${issue.key}: ${updateValidationResult.errorCollection}") } }
]
to also check that the user-provided "other" value doesn’t actually already exist in the list.