I have a very easy script implemented as a post-function upon issue creation.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Origin")
def cfValue = issue.getCustomFieldValue(cf)
if (cfValue == 'Support') {
issue.setReporter(sthomson)
}
I have also tried issue.setReporter('Steve Thomson'), but that did not work either.
In addition, I did have logging in place and confirmed that "cfValue == 'Support'. Here is the script with the logging:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import org.apache.log4j.Level
import org.apache.log4j.Logger
def myLog = Logger.getLogger("com.onresolve.jira.groovy")
myLog.setLevel(Level.DEBUG)
def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Origin")
def cfValue = issue.getCustomFieldValue(cf)
myLog.debug("Origins value: " + cfValue)
if (cfValue == 'Support') {
issue.setReporter(sthomson)
}
else {
myLog.debug("Did not update the reporter because value of Origin field was not Support")
}
Please help.