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)
The script in 3rd post function I changed 4th one to 3rd and tried. so that it assign to the selected assignee and assign back to project lead at the same time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.