Hello to everyone!
I wrote a script that must to change assignee in an issue, but it doesn't work without any error.
I have "customfield_10300" (Epic Link) and username "jandall". This script runs in postfunctions via ScriptRunner. But when I changing the transition of issue or creates it nothing happens. Script runs but with no changing of assignee.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
MutableIssue curIssue = issue
def condField = "customfield_10300"
def target = "assignee"
def cfManager = ComponentAccessor.getCustomFieldManager()
def cfCond = cfManager.getCustomFieldObject(condField)
def selectedVal = cfCond.getValueFromIssue(curIssue)
def cfTarget = cfManager.getCustomFieldObject(target)
if (selectedVal == "TBAS-1") {
curIssue.setCustomFieldValue(cfTarget, "jandall")
} else if (selectedVal == "TBAS-2") {
curIssue.setCustomFieldValue(cfTarget, "mdavis-sd-demo")
}
What am I doing wrong?