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 Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

301 views 0 12
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot