Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi!
We are automatically calculating a ticket's priority based on chosen impact + urgency. We have implemented a Scriptrunner behaviour according to these instructions: https://library.adaptavist.com/entity/set-priority-using-an-impact-urgent-matrix
The actual implementation looks as follows:
Initialiser script:
import com.atlassian.jira.issue.IssueFieldConstants
def priorityField = getFieldById(IssueFieldConstants.PRIORITY)
priorityField.setFormValue("Low")
priorityField.setReadOnly(true)
priorityField.setHidden(true)
Impact + Urgency Field script (identical):
import com.atlassian.jira.issue.IssueFieldConstants
import groovy.transform.BaseScript
import com.onresolve.jira.groovy.user.FieldBehaviours
@BaseScript FieldBehaviours fieldBehaviours
def urgency_1 = "1-Critical - impact already occurred or imminent"
def urgency_2 = "2-High - impact by end of business day"
def urgency_3 = "3-Medium - impact within the next days"
def urgency_4 = "4-Low - no impact forecast"
def impact_1 = "1-Extensive (widespread, 500+ users affected, reputation or legal exposure for EvilCorp)"
def impact_2 = "2-Significant (large, 50+ users affected, business process interrupted)"
def impact_3 = "3-Moderate (limited, <50 users affected)"
def impact_4 = "4-Minor (local, <5 users affected)"
def prio_critical = "Critical (Highest)"
def prio_high = "High"
def prio_medium = "Medium"
def prio_low = "Low"
def priorityMatrix = [
(urgency_1): [
(impact_1): prio_critical,
(impact_2): prio_high,
(impact_3): prio_medium,
(impact_4): prio_low
],
(urgency_2): [
(impact_1): prio_high,
(impact_2): prio_high,
(impact_3): prio_medium,
(impact_4): prio_low
],
(urgency_3): [
(impact_1): prio_medium,
(impact_2): prio_medium,
(impact_3): prio_low,
(impact_4): prio_low
],
(urgency_4): [
(impact_1): prio_low,
(impact_2): prio_low,
(impact_3): prio_low,
(impact_4): prio_low
]
]
def priorityField = getFieldById(IssueFieldConstants.PRIORITY)
def impactFieldValue = getFieldByName("Impact").value as String
def urgencyFieldValue = getFieldByName("Urgency").value as String
def priority = prio_low
if (impactFieldValue && urgencyFieldValue) {
priority = priorityMatrix[urgencyFieldValue][impactFieldValue]
}
priorityField.setFormValue(priority)
This works fine unless you start using the browser's back button!
How to reproduce?
Any ideas what could be wrong here or how to troubleshoot this any further?
Updates:
Thanks,
Robert
I managed to get a Urgency/Impact matrix to work with the following script.
It's applied to a behaviour where the priority field is read only and it's applied to both the Urgency and Impact fields.
import com.atlassian.jira.issue.IssueFieldConstants
import groovy.transform.BaseScript
import com.onresolve.jira.groovy.user.FieldBehaviours
@BaseScript FieldBehaviours fieldBehaviours
def prio_critical = "P1"
def prio_high = "P2"
def prio_medium = "P3"
def prio_low = "P4"
def priorityMatrix = [
High : [
High : prio_critical,
Medium : prio_high,
Low : prio_medium,
],
Medium : [
High : prio_high,
Medium : prio_medium,
Low : prio_low,
],
Low : [
High : prio_medium,
Medium : prio_low,
Low : prio_low,
]
]
def priorityField = getFieldById(IssueFieldConstants.PRIORITY)
def impactFieldValue = getFieldByName("Business Impact").value as String
def urgencyFieldValue = getFieldByName("Urgency").value as String
if (impactFieldValue && urgencyFieldValue) {
def priority = priorityMatrix[urgencyFieldValue][impactFieldValue]
priorityField.setFormValue(priority)
}
Hello Robert,
Did you solve your pb?
I tried to reproduce your config but it was not successful for me.
If you have a few seconds, can you tell me if your script is working on the customer portal or in the create issue view ?
Regards,
Guillaume
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guillaume,
the issue occurs in the customer portal.
There's an open ScriptRunner defect: https://productsupport.adaptavist.com/browse/SRJIRA-4284
R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.