Two Factor Priority Fields

I would like to create a new priority field that is automatically calculated from two other single dropdown fields or a single cascading dropdown field (whichever is easier). The two factors would be below Frequency (4 options) and impact (12 options), and based on those inputs the new priority would be calculated. 

 

Is this possible using Script Runner?

3 answers

Hi Bryan,

Taking Gabrielle and Doug's comments a little further, the code you'll want will look something like this:

def frequency = getCustomFieldValue("Frequency").getValue()
def impact = getCustomFieldValue("Impact").getValue()
 
if (frequency && impact) {
	switch (frequency) {
		case "First Frequency":
			switch (impact) {
				case "First Impact":
						return "something"
				case [...]
			}
		case [...]
	}
}

Obviously, replacing the switch/case statements with whatever logic you're after (I include those as a simplistic example).  If you have any other questions, please post here.

Hi Jamie, Thank you so much for the information. This is very helpful. I used your Query in the inline script field for the "True Priority" Script field. I am not able to return anything. The "True Priority" field doesn't even show on the issue even though it has been added to the screen. Here is the Query I am using, for only one case to test. def frequency = getCustomFieldValue("Frequency").getValue() def impact = getCustomFieldValue("Impact").getValue() if (frequency && impact) { switch (frequency) { case "Always": switch (impact) { case "Security: In Production": return "P1" } }

Hi Jamie, Do you have any insight on this?

The "Scripted Field" can do this. Alternatively, a "Post function" to "Set Field Value to constant or Groovy expression" can do that too with Conditional Execution based on what you need.

As Gabriella said - Yes this is possible with a Script Runner scripted field. We do something very similar.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

49 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you