Hi All,
I have created a script which allows to update a select list A by changing the value of a select list B. However, it is not working, please suggest:
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
FormField selectList1 = getFieldById("customfield_20650")
FormField selectList2 = getFieldById("customfield_20156")
def selectList1Val = selectList1.getValue()
if(selectList1Val.toString().contains("Australia")){
selectList2.setFormValue(17305)
}
error in logs:
java.lang.NullPointerException: Cannot get property 'customfield_20650' on null object
at com.onresolve.jira.groovy.user.FormField.getValue(FormField.groovy:181)
at com.onresolve.jira.groovy.user.FormField$getValue.call(Unknown Source)
at Script38.run(Script38.groovy:17)
What Am i doing wrong here? Please help