I have this Listener (below). What I want to happen:
When the issue type is set as 'Enhancement Request' by a specified author, assign the issue to another specified user (user).
If the event author is not the user I've specified, ignore this auto-assignment.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue;
import org.apache.log4j.Category;
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.issue.MutableIssue
def Category log = Category.getInstance("com.onresolve.jira.groovy")
log.setLevel(org.apache.log4j.Level.INFO)
Issue issue = event.issue as MutableIssue
def issueObject = issue.getKey()
def author = event.getUser().getDisplayName()
if( ["Enhancement Request"].contains(issue.issueType.name) && author == {string username})
{ log.info 'Issue Type is Enhancement Request.'
def userManager = ComponentAccessor.getUserManager()
def user = ComponentAccessor.getUserManager().getUserByKey({string username})
def admin = userManager.getUserByName({string username})
issue.setAssigneeId(user)
return "Author = " + { log.info author.toString() };
return "Assignee = " + { log.info user.toString() };
}
@Adaptavist Supp