Hi All,
I have behavior set for a custom numeric field named "Scalar". I want to set an initializer on edit screen for this field. If the field exisitng value is empty, set default to '0' or else set the existing value on the FormField for scalar field. Below is the code I am testing
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
import com.atlassian.jira.user.ApplicationUser
def cd = getFieldByName("Scalar")
//def cd = customFieldManager.getCustomFieldObject(getFieldChanged())
def svalue = cd.getValue()
log.error("value: " +svalue)
def defaultValue = 0
if (getActionName() == null) {
if(svalue == null) {
cd.setFormValue(defaultValue)
}else{
cd.getFormValue()
}
}
I get an error "java.lang.NumberFormatException: For input string: "" "
How do I handle this, please guide.
Thanks,
Deepali