Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Script for updating assignee

Eshwar Palem March 20, 2019

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"))

}

1 answer

0 votes
Zachary Miller May 2, 2019

Hi @Eshwar Palem 

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)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events