Forums

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

Change Priority based on another customfield value in inline groovy script

NorskK
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 29, 2015

Hi.

So I have this case where I want to set the Priority based on a custom severity field upon creation of an issue.

With a Groovy inline script I have the following, but I can't get it to work right. Can you help me?

MutableIssue myIssue = issue;
switch(cf["customfield_10500"].getValue())
{
  case "Extreme":
   myIssue.setPriorityId("2");
   myIssue.store();
   break;
 
 case "Bad":
   myIssue.setPriorityId("3");
   myIssue.store();
   break;
 
 case "Not so bad": 
   myIssue.setPriorityId("4");
   myIssue.store();
   break;
}

 

 

1 answer

0 votes
Arthur Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2015

Hey,

Have you considered using a Priority object, as explained on this post? I believe that it would work for you.

-- Arthur Gonçalves

Suggest an answer

Log in or Sign up to answer