I have a Custom Field that is a select list. When an issue is created, I would like the issue to be assigned to a particular user in a script runner post-function based on the value of that custom field selected on the Create Screen. I have tried a million different things, and nothing seems to work - the issue always gets assigned to the Project Lead. Can anyone point out what I'm doing wrong?
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def taskTypeField = customFieldManager.getCustomFieldObjectByName("Task Type")
def taskType = issue.getCustomFieldValue(taskTypeField).toString()
def project = issue.getProjectObject()
def lead = project.getProjectLead()
def reporter = issue.getReporter()
if(taskType == "Self-Directed")
{
issue.setAssignee(reporter)
}
else
{
issue.setAssignee(lead)
}