We intend on setting The Priority Based on the summary for one of our SD's. For Example exemplarie mail subject "[...](Priority:1)[...]", which creates an issue with the summary [Ticketnumber][...](Priority:1)[...].
What we want to do:
1. get the issue.summery content
2. Look up the number after "Priority:"
3. Priority accordingly
Currently used code:
import com.atlassian.jira.issue.MutableIssue;
MutableIssue mutableIssue = (MutableIssue) issue;
String subject=issue.summary; //gets the summary
int indexfind; //Help Index to Find "Priority:"
indexfind=subject.indexOf("Priority:"); //finds 'P' of "Priority:"
String Prio=subject.charAt(indexfind+9); // finds the number of summary
switch (Prio){
case "1": mutableIssue.setPriorityId("2"); //set prio Critical
break;
case "2": mutableIssue.setPriorityId("3"); //set prio high
break;
case "3": mutableIssue.setPriorityId("4"); //set Prio Moderate
break;
case "4": mutableIssue.setPriorityId("5"); //set Prio Low
break;
default: mutableIssue.setPriorityId("5"); //sets to default od Low
break;
}
The Script runner does not throw in exception but the intended use is not given. Couldt you please help me resolve this issue?