Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Problem w/ Scriptrunner priority calculation based on impact/urgency when using browser back button Edited

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?

  • Create a new incident (in the user portal), select Impact and Urgency accordingly
    • A new ticket will be created with the correctly calculated priority
  • Now go back using the browser back button
  • Chose the lowest Impact and Urgency -> a Low prio ticket should be created
    • Instead, the new ticket is created with a priority of "High"
    • Sometimes, the priority field even shows on the form, even though it was set to hidden!

Any ideas what could be wrong here or how to troubleshoot this any further?

Updates:

  • I should mention we're on 5.6.2.1-jira8. I know that this is a fairly outdated version, but I have not found any bugs in the 5.x release notes that seem to relate to this problem.
  • I updated to 6.4.0-p5 but the problem is still there. 
  • The main problem seems to be that:
    • For some reason the Priority field shows (even though it should not) with a default value of "High"
    • Changing Impact + Urgency does not alter the Priority field
    • Thus, when the user submits the form the ticket is created with the incorrect Priority High

Thanks,
Robert

 

 

2 answers

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  

Hi Guillaume,

the issue occurs in the customer portal.

There's an open ScriptRunner defect: https://productsupport.adaptavist.com/browse/SRJIRA-4284

R

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)
}

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

New Cloud Apps Roundup - April 2021

Atlassian's marketplace partners have had a very productive start to 2021! Since our last roundup, our developer community has added over 160 new cloud apps to the Atlassian Marketplace to help you...

317 views 3 20
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you