I'm trying to assign a user to a user picker custom field base on the value of another custom field (dropdown). For example, there are 4 values (Product, Customer, Support, Accounts) in a dropdown field. If the user selects "Product" the user picker custom field should have a user (George), if the user select "Support" from the dropdown then the custom user field should have the value "Parker". If user select other two options then it should have default value "Mark". I tried but some reason it is just picking the default user "Mark" for all selection. Any idea how to make it work? Following is my behaviour script. Thank you for your help.
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def custAssignee = 'mark'
def custField = getFieldByName("Inventory")
if(custField.value == 'Product') {
custAssignee = 'george'
}
if(custField.value == 'Support') {
custAssignee = 'parker'
}
def customerAssigneeFormField = getFieldById('customfield_11305')
customerAssigneeFormField.setFormValue(custAssignee)