Hi good day community,
Requesting your help on this please:
I am trying to find the right groovy script to change an issue type from one to another ONLY if certain criteria is met. Once an issue is created, if the Description contains the word "bug", this script should run and change the issue type from Story to Bug. I am trying to add it in a post function in the transition Create but I know some things in my script are not there ( I am a newby in Scriptrunner scripts)
Could some one please help me out?
Is not too much but this is what I have now:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.MutableIssue;
if (issue.getDescription().contains("Bug") {
MutableIssue issue = issue;
if(issue.issueType.name == "Story") {
def newIssueType = ComponentAccessor.issueTypeSchemeManager.getIssueTypesForProject(issue.projectObject).find{it.name=="Bug"};
if (newIssueType) issue.setIssueTypeObject(newIssueType);
}
}