Hi
I want to add a postfunction script that sets the assignee based on a custom fields value.
So for example when field 'Product' (Select List Single Choice) a has value 'Cloud' then it should be assigned to person 'gwll' user name. If it's value 'Server' then it should be person 'Johnl' user name. We do have scriptrunner, can anybody tell me how the script should look to enable this?
I tried the following script but it set the assignee value on issue as unassignee
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
String userName;
switch(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Product").toString()){
case "Cloud": userName = "gwll";break;
case "Server": userName = "Johnl";break;
}
issue.setAssignee(ComponentAccessor.getUserManager().getUserByName(userName))
Jira - 7.2.7
ScriptRunner - 5.2.1
thanks for your help