Hello,
I want to change the assignee of an issue based on a checkbox. if the value "Related" is check in the custom filed "Customer Related", I want the assignee to be change to some one else.
I tried to do the following using scriptrunner post function:
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.user.util.UserManager;
ComponentManager componentManager = ComponentManager.getInstance();
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager();
CustomField customer_Related= customFieldManager.getCustomFieldObject("customfield_xxxx");
customer_Related_Value = issue.getCustomFieldValue(customer_Related);
if (customer_Related_Value*.value.contains("Related"))
{
User usera = userManager.getUser('Username');
issue.setAssignee(usera);
issue.store()
}But I got the following error:
The script could not be compiled:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script63.groovy: 12: unable to resolve class User
@ line 12, column 10.
User usera = userManager.getUser('Username');
^
1 errorThanks,
Ben