Getting accustomed to Groovy, I need to gather 2 number custom field values in JIRA, and perform a calculation on those 2 field values, then return that result to another (3rd) custom field using this script. But I am still understanding how global and local variables work. How can I return the calculation based below to a 'finalResult' field as indicated below, my variables valuePA and valueCA are not recognized in the if/then statement. I appreciate any feedback!!
FormField paidAmount = getFieldByName("Paid Amount")
def valuePA = paidAmount.getValue()
FormField correctAmount = getFieldByName("Correct Amount")
def valueCA = correctAmount.getValue()
//performing logic on values from correctAmount and paidAmount
def finalResult() {
if (valuePA <= valueCA) {
return (valuePA / valueCA) * 100
} else (valueCA < valuePA) {
return ((valueCA - valuePA) / valueCA) * 100
}
}
Then I will take the finalResult and use it to update the 3rd custom field.
Aucun commentaire:
Enregistrer un commentaire