import com.atlassian.jira.event.issue.IssueEvent;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.event.type.EventDispatchOption;
Issue issue = event.getIssue();
MutableIssue mutableIssue = null;
mutableIssue = issue;
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
if(issue.getIssueType().getName().equalsIgnoreCase("Legal"))
{
mutableIssue.setAssignee(user);
ComponentAccessor.getIssueManager().updateIssue(user, mutableIssue, EventDispatchOption.DO_NOT_DISPATCH, false);
}
The above one is my script to set the assignee when an issue is moved from one issuetype to another issuetype,the assignee should be of issuetype to which an issue is moved.
I am getting an error like "cannot an assign value of type com.atlassian.jira.issue.Issue to variable of type to com.atlassian.jira.issue.MutableIssue"
Try
mutableIssue = ComponentAccessor.getIssueManager().getIssueByCurrentKey(issue.getKey);
Hi, @Tom Lister
Now my script is with zero errors after adding the above line, thanks for that. but when I am adding this to Script listeners in Scriptrunner it is not running yet after doing the move operation. Do you have any suggestions for this like what will be the solution.
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Hard to say without running it. Are there any errors in the Jira log?
can you put some logging statements in your code.
Even if it’s compiling it may be having an error retrieving the issue. Possibly getting a nullpointerexception
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tom,
I am getting this error:
groovy.lang.MissingPropertyException: No such property: event for class: Script299 at Script299.run(Script299.groovy:18).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.