I'm looking to have a post function assign a JIRA issue depending on two fields that are of the single select type (Region and Network). Although the JIRA in question has both fields set with values that are described in the IF statement the user assigned is userB. Is there something I'm missing in the script below?
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
//define custom field manager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
//define custom fields
def Network = customFieldManager.getCustomFieldObject("customfield_10742")
def Region = customFieldManager.getCustomFieldObject("customfield_14440")
def userA = ComponentAccessor.userManager.getUserByName("John")
def userB = ComponentAccessor.userManager.getUserByName("Maria")
if(Network == "Airport"){
issue.setAssignee(userA)
}
else{
issue.setAssignee(userB)
}