Update custom filed values based on selecting custom filed Values.

PRAMOD KUMAR REDDY KASIREDDY December 7, 2021

1.png2.png3.png

We Have custom fields called 1) initial Impact and 2) initial Probability and 3) initial rating
The filed values are alpha and numeric:-

1- Very Low – 10%

2- Low – 30%

3- Medium – 50%

4- High- 70%

5- Very High- 90%
Now the requirement is by selecting the Values of Initial Impact and initial Probability. Then the value of Initial rating should be generated automatically.Field values.png

1 answer

0 votes
PRAMOD KUMAR REDDY KASIREDDY December 7, 2021

I have Edited Formula Based on Our Values. but it's not working. while creation of issue there is no changes.

import com.atlassian.jira.issue.IssueFieldConstants
import groovy.transform.BaseScript
import com.onresolve.jira.groovy.user.FieldBehaviours

@BaseScript FieldBehaviours fieldBehaviours

def ratingMatrix = [
'Very high - 90%' : [
'Very High - 90%' : 'High - 70%',
'High - 70%' : 'High - 70%',
'Medium - 50%' : 'High - 70%',
'Low - 30%' : 'High - 70%',
'Very Low - 10%' : 'Medium - 50%',
],
'High - 70%' : [
'Very High - 90%' : 'High - 70%',
'High - 70%' : 'High - 70%',
'Medium - 50%' : 'High - 70%',
'Low - 30%' : 'Medium - 50%',
'Very Low - 10%' : 'Medium - 50%',
],
'Medium - 50%' : [
'Very High - 90%' : 'High - 70%',
'High - 70%' : 'High - 70%',
'Medium - 50%' : 'Medium - 50%',
'Low - 30%' : 'Medium - 50%',
'Very Low - 10%' : 'Low - 30%',
],
'Low - 30%' : [
'Very High - 90%' : 'High - 70%',
'High - 70%' : 'Medium - 50%',
'Medium - 50%' : 'Medium - 50%',
'Low - 30%' : 'Low - 30%',
'Very Low - 10%' : 'Low - 30%',
],
'Very Low - 10%' : [
'Very High - 90%' : 'Medium - 50%',
'High - 70%' : 'Medium - 50%',
'Medium - 50%' : 'Low - 30%',
'Low - 30%' : 'Low - 30%',
'Very Low - 10%' : 'Low - 30%',
]
]

def impactFieldValue = getFieldByName('Initial Impact').value as String
def probabilityFieldValue = getFieldByName('Intial Probability').value as String

def rating = ratingMatrix[impactFieldValue][probabilityFieldValue]
def ratingField = getFieldByName('Initial Rating')
ratingField.setFormValue(rating)

This is the formula i'm using in Behaviors.

Pls Help on this.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events