Hi Community, I need help on assigning group that is based on the value of single list select custom field
Scenario is
When I choose a value on single select list (i.e. I have Affected Service as the single select list, then I select Power as the value of it ) , a group will be assigned on that ticket., group will be assigned depending on the value that is selected on Affected Service Field.
Currently, I'm using this code to capture the Assignee Field based on the value selected on the Affected Service Field using ScriptRunner Post Function. Is it possible to reuse this code to capture the groups? group will be added on the ticket depending on the value selected. Thanks!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
String user;
def cfManager = ComponentAccessor.getCustomFieldManager();
def cf = cfManager.getCustomFieldObjectByName("Affected Service");
switch(issue.getCustomFieldValue(cf) as String){
case "Hardware": user = "jiraadmin";break;
case "Salesforce": user = "w00377";break;
case "Mashery": user = "sample";break;
}
issue.setAssignee(ComponentAccessor.getUserManager().getUserByKey(user))