cancel
Showing results for
Did you mean:
See all
See all
##### Groups
Explore all groups

# 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?

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 &amp;&amp; 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.

Community showcase
Posted Oct 09, 2018 in Jira Core

### How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

382 views 6 0

### Atlassian User Groups

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

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.