So, the scenario is like when an issue is moved from one issuetype to another issuetype the assignee should remain same i.e auto assignee of issuetype to which an issue moved.
here is my script:
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.event.type.EventDispatchOption;
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.event.issue.IssueEvent;
Issue issue = event.getIssue();
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
def mutableIssue = (MutableIssue)issue;
if(mutableIssue.getIssueType() == "Legal")
{
mutableIssue.setAssignee(ComponentAccessor.getUserManager().getUserByName("Cheryl.Marquez"))
}
I would refer to https://community.atlassian.com/t5/Jira-questions/Updating-assignee-via-scriptrunner/qaq-p/637155
Basically just replace what is inside your if statement with
def validateAssignResult = issueService.validateAssign(user, issue.id, issue.reporterId)
issueService.assign(user, validateAssignResult)
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.