Hi All,
I have this script assigning issues to particular users based on specific words in the summary and default to project lead. But when user selects the assignee in the create screen it still default to the project lead.
Can some one suggest changes to this script to skip assigning to project lead when user select one in the create screen?
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.*;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.project.Project;
import com.atlassian.jira.project.ProjectManager;
MutableIssue myIssue = issue;
String summary = issue.getSummary();
String userName;
def userManager = ComponentAccessor.userManager;
log.error("Summary choosen: " + summary)
//Capture string in the summary to assign to helpdesks
if (myIssue.summary.toString().matches(".*AAA")){
userName = "e1111111"
}
else if (myIssue.summary.toString().matches("(.*)#BBB#(.*)")) {
userName = "e2222222"
}
else {
userName = issue.getProjectObject().getProjectLead().getKey()
}
log.error("Username chosen: " + userName)
//Assigning the issue to the value picked by userName
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
issue.setAssignee(ComponentAccessor.getUserManager().getUser(userName))
ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)