You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Update a Single-Select (Drop Down) Custom Field


Update the select option of a Single Select List custom field.


I am a Project Manager. I have issues with one single select custom field called size. This custom field indicates the issue's estimated duration. I want to select the option S in this single select for the issue with an specific key. With this console script I can change this option automatically.

Good to Know

  • Single select options can be customized with needed values.
  • You can configure the script with the values of 'customFieldName', 'newValue', and 'issueKey' that you need.
  • The 'newValue' should be included into single select options


  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.ModifiedValue import com.atlassian.jira.issue.util.DefaultIssueChangeHolder // the name of the custom field (single select list type) final customFieldName = 'Single Select List' // the value of the new option to set final newValue = 'Option C' // the issue key to update final issueKey = 'TEST-1' def issue = ComponentAccessor.issueManager.getIssueByCurrentKey(issueKey) assert issue: "Could not find issue with key $issueKey" def customField = ComponentAccessor.customFieldManager.getCustomFieldObjects(issue).findByName(customFieldName) assert customField: "Could not find custom field with name $customFieldName" def availableOptions = ComponentAccessor.optionsManager.getOptions(customField.getRelevantConfig(issue)) def optionToSet = availableOptions.find { it.value == newValue } assert optionToSet: "Could not find option with value $newValue. Available options are ${availableOptions*.value.join(",")}" customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), optionToSet), new DefaultIssueChangeHolder())
Discovered an issue? Report it here

Suggested for you

Appears in these Collections