Good morning, guys!
I'm trying to create a "Score Point" field based on the other three fields I have (Value, Impact, and Effort).
I have already created the field Score Point as a Number Field, and I'm trying to use the script below on my automation:

// Initialize numeric variables
let numericValue = 0;
let numericImpact = 0;
let numericEffort = 0;
// Convert 'Value' to numeric
if ({{issue.customfield_10381}} == "Very High") {
numericValue = 5;
} else if ({{issue.customfield_10381}} == "High") {
numericValue = 4;
} else if ({{issue.customfield_10381}} == "Medium") {
numericValue = 3;
} else if ({{issue.customfield_10381}} == "Low") {
numericValue = 2;
} else if ({{issue.customfield_10381}} == "Very Low") {
numericValue = 1;
} else {
numericValue = 0; // Or handle unexpected value as needed
}
// Convert 'Impact' to numeric
if ({{issue.customfield_10004}} == "Very High Impact") {
numericImpact = 5;
} else if ({{issue.customfield_10004}} == "High Impact") {
numericImpact = 4;
} else if ({{issue.customfield_10004}} == "Moderate Impact") {
numericImpact = 3;
} else if ({{issue.customfield_10004}} == "Low Impact") {
numericImpact = 2;
} else if ({{issue.customfield_10004}} == "Very Low Impact") {
numericImpact = 1;
} else {
numericImpact = 0; // Or handle unexpected value as needed
}
// Convert 'Effort' to numeric
if ({{issue.customfield_10380}} == "Very Difficult") {
numericEffort = 5;
} else if ({{issue.customfield_10380}} == "Difficult") {
numericEffort = 4;
} else if ({{issue.customfield_10380}} == "Moderate") {
numericEffort = 3;
} else if ({{issue.customfield_10380}} == "Easy") {
numericEffort = 2;
} else if ({{issue.customfield_10380}} == "Very Easy") {
numericEffort = 1;
} else {
numericEffort = 0; // Or handle unexpected value as needed
}
// Calculate 'Score Point'
let scorePoint = (numericValue * 0.3) + (numericEffort * 0.2) + (numericImpact * 0.5);
// Set the value of the 'Score Point' field
{{issue.customfield_10424}} = scorePoint;I don't know if I'm on the right way, as I'm not really into Jira scripting.
Any help is very welcome!
Thanks!