Hi, I am trying to sum three custom number fields and display that total using a scripted field. I've searched tirelessly for solutions and there's loads of great stuff out there but every time I grab something from the forums I receive an error message - I can diagnose to an extent but that causes something else.
The latest code I am trying to use is:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.opensymphony.workflow.WorkflowContext
def aval = getCustomFieldValue("field1")
def bval = getCustomFieldValue("field2")
def cval = getCustomFieldValue ("field3")
// check both fields contain valid numeric values and if not set them to 0
if (aval == null) {
aval = 0
}
if (bval == null) {
bval = 0
}
if (cval == null) {
cval = 0
}
if (aval != null && bval !=null && cval !=null){
return aval + bval + cval}
else{
// return to some code to indicate a null value in one of the fields
return "0"
}
The problem is that it doesn't seem to like the calculation aval + bval + cval and throws up an error:

Anyone able to help me?
Many Thanks