Hi,
Before I explain what I would like to achieve, here my question:
Is it possible to compute a field value in Jira automation to an extend I have in the following Groovy script?
I want to use Jira automation to calculate a value for a field, depending on two other fields which should be multiplied (Since the base fields hold the labels I first need to get the values scores)
Unfortunately the app, in which I need the value, does not support calculated custom fields. If the user edits the issue, updating any one of my to base fields I want to recalculate the depending field and set its value.
In the calucated field, if I could use it, I would use a Groovy script as follows to set the calculated field:
def significance = [Negligible:1, Moderate: 2, Significant: 3, Extensive:4, Catstrophic:5]
def probability = [Theoretical:1, Unlikely: 2, Possible: 3, Likely:4, Frequent:5]
Integer s = 0
Integer p = 0
//Evaluating the expression value
switch(issue.get("customfield_13418")) {
case "Negligible":
s = significance["Negligible"]
break
case "Moderate":
s = significance["Moderate"]
break
case "Significant":
s = significance["Significant"]
break
case "Extensive":
s = significance["Extensive"]
break
case "Catstrophic":
s = significance["Catstrophic"]
break
default:
s = 0
break;
}
switch(issue.get("customfield_13410")) {
case "Theoretical":
p = probability["Theoretical"]
break
case "Unlikely":
p = probability["Unlikely"]
break
case "Possible":
p = probability["Possible"]
break
case "Likely":
p = probability["Likely"]
break
case "Catstrophic":
p = probability["Frequent"]
break
default:
p = 0
break;
}
// return the value
s*p
Thanks for any idea!