I am attempting to create a scripted field that will calculate Risk based on Impact and Likelihood.
Both the Impact and Likelihood fields are a single select dropdown field. To do the calculation, I need to convert the String to an Integer. In Jira Datacenter, I know I can create an If/else statement that looks something like this:
def likelihood = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Risk Likelihood"))
if ( "Rare".equals (likelihood.getValue()) ) {
likelihood = 1
} else if ( "Unlikely".equals (likelihood.getValue()) ) {
likelihood = 2
} else if ( "Moderate".equals (likelihood.getValue()) ) {
likelihood = 3
} else if ( "Likely".equals (likelihood.getValue()) ) {
likelihood = 4
} else if ( "Almost Certain".equals (likelihood.getValue()) ) {
likelihood = 5
} else {
return null
}
On Jira Cloud, I can not use .equals
Does anyone know the Cloud equivalent?