Hi community, looking for some assistance on this one.
Using Scriptrunner Behaviors, when a user selects an option in custom list called "Category" I would like to set an existing value in my custom list field "Group". I'm able to retrieve the Category values without an issue, however I cannot set the Group select list value (by name or by option ID). Can someone please assist in how to set this select list value?
Here is the script:
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
// Define both custom select lists
def category = getFieldByName("Category")
def group = getFieldByName("Group")
// Get the Value of the Category field and Group field
def catval = category.getValue()
log.warn("Category Value: " + catval)
def groupval = group.getValue()
log.warn("Group Value: " + groupval)
// If the Category select list value equals Other
if (catval == "Other"){
// Set the value of the select list to Group option id of 12208 "Test Group"
group.setFormValue(12208)
}