We have a requirement, as one of our internal team has moved from a "different system" to Jira ServiceDesk. In their different system, They have the following fields
1. Impact- a dropdown custom field with options I1 I2 I3 I4
2. Urgency - a dropdown custom field with options U1 U2 U3 U4
3. Priority - a dropdown system field with options P1 P2 P3 P4
4. Weight - Single-line textbox which holds a number(n1 n2 n3 n4 n5...n10)
I could do the following:
While creating issue user will choose impact and urgency, based on I1 and U2 I can update Priority(P3) and Weight(n3) using Jira service desk automation
I couldn't achieve:
I would like to develop the same functionality when Impact & Urgency is edited priority & weight should get updated as well after creating an issue.
Any help is very much appreciated. I tried something similar with a text box but now with options.
Impact:
Extensive/Widespread - I1
Significant/Large- I2
Moderate/Limited- I3
Minor/Localized -I4
Urgency:
Critical - U1
High- U2
Medium -U3
Low- U4
------------------------------------------------------------------------------
Priority:
Critical - P1
High -P2
Medium-P3
Low - P4
Weight:
Single line text box
Combinations: I(x) U(y) then P(a) W(n)
I1 U1 ---> P1 29
I1 U2 ---> P1 24
I1 U3 ---> P2 19
I1 U4 ---> P4 9
I2 U1 ---> P1 25
I2 U2 ---> P2 20
I2 U3 ---> P3 15
I2 U4 ---> P4 5
I3 U1 ---> P2 23
I3 U2 ---> P2 18
I3 U3 ---> P3 13
I3 U4 ---> P4 3
I4 U1 ---> P2 20
I4 U2 ---> P3 15
I4 U3 ---> P3 10
I4 U4 ---> P4 0
Thanks, in advance
Hi @Sysad ,
I would advise to create a behaviours against impact and urgency field, using this script for both of them :
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import static com.atlassian.jira.issue.IssueFieldConstants.PRIORITY
@BaseScript FieldBehaviours fieldBehaviours
log.error("Start of the script...")
def priorityMap = [[impact:"Extensive/Widespread - I1", urgency:"Critical - U1", priority: "1", weight: "29"],
[impact:"Extensive/Widespread - I1", urgency:"High - U2", priority: "1", weight: "24"],
[impact:"Extensive/Widespread - I1", urgency:"Medium - U3", priority: "2", weight: "19"],
[impact:"Extensive/Widespread - I1", urgency:"Low - U4", priority: "4", weight: "9"],
[impact:"Significant/Large - I2", urgency:"Critical - U1", priority: "1", weight: "25"],
[impact:"Significant/Large - I2", urgency:"High - U2", priority: "2", weight: "20"],
[impact:"Significant/Large - I2", urgency:"Medium - U3", priority: "3", weight: "15"],
[impact:"Significant/Large - I2", urgency:"Low - U4", priority: "4", weight: "5"],
[impact:"Moderate/Limited - I3", urgency:"Critical - U1", priority: "2", weight: "23"],
[impact:"Moderate/Limited - I3", urgency:"High - U2", priority: "2", weight: "18"],
[impact:"Moderate/Limited - I3", urgency:"Medium - U3", priority: "3", weight: "13"],
[impact:"Moderate/Limited - I3", urgency:"Low - U4", priority: "4", weight: "3"],
[impact:"Minor/Localized - I4", urgency:"Critical - U1", priority: "2", weight: "20"],
[impact:"Minor/Localized - I4", urgency:"High - U2", priority: "3", weight: "15"],
[impact:"Minor/Localized - I4", urgency:"Medium - U3", priority: "3", weight: "10"],
[impact:"Minor/Localized - I4", urgency:"Low - U4", priority: "4", weight: "0"],]
def priority = getFieldById(PRIORITY)
int impactId = 12100
def impact = getFieldById("customfield_" + impactId)
def impactValue = impact.getValue() as String
log.error("impactValue : " + impactValue)
int urgencyId = 12101
def urgency = getFieldById("customfield_" + urgencyId)
def urgencyValue = urgency.getValue() as String
log.error("urgencyValue : " + urgencyValue)
int weightId = 12102
def weight = getFieldById("customfield_" + weightId)
def priorityValue = priorityMap.find { it.impact == impactValue && it.urgency == urgencyValue }?.priority as String
def weightValue = priorityMap.find { it.impact == impactValue && it.urgency == urgencyValue }?.weight as String
log.error("priorityValue : " + priorityValue)
log.error("weightValue : " + weightValue)
if (priorityValue) {
priority.setFormValue(priorityValue)
}
if (weightValue) {
weight.setFormValue(weightValue)
}
log.error("End of the script...")
Please make sure the values in the map match exactly your custom field values, except for priority which you can leave as is since it is a system field. Also update the custom field ids. You could set priority and weight fields as read only if needed.
Let me know if that helped.
Antoine
Thank you for your time & effort. Users like you will make the community thrive.
Based on my implementation, plz correct me if I made a mistake.
As well as I have used two behaviors for two fields and yet the same result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Sysad :) I will try to help you further to deserve these kind words.
It seems you have done everything right. To ensure that you could screenshot your behaviours configuration. Next step is to add some logs in the script/check the logs. Please see updated answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does your instance have Script Runner add-on? You could script behaviors for this.
https://scriptrunner.adaptavist.com/5.6.7/jira/behaviours-overview.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.