I had the following script in behaviour. This script checks on SW/FPGA label and then enables the setrequired function. This was working fine. But I did an update (have always the latest plugin version, Jira 7.8.1) and now it fails.
<code>
def labelsField = getFieldById("labels")
def revisionField = getFieldById("customfield_12307")
try {
if ((labelsField.getValue().toUpperCase() == "SW") ||
(labelsField.getValue().toUpperCase() == "FPGA")) {
revisionField.setRequired(true);
}
else {
revisionField.setRequired(false);
}
}
catch (ex) {
if ((labelsField.getValue().toUpperCase().contains("SW")) ||
(labelsField.getValue().toUpperCase().contains("FPGA"))) {
revisionField.setRequired(true);
}
else {
revisionField.setRequired(false);
}
}
</code>
<error>
at Script1.run(Script1.groovy:16)
java.lang.NullPointerException: Cannot invoke method toUpperCase() on null object
2018-04-06 13:19:23,136 http-nio-8080-exec-10 ERROR ROBS 799x7349x1 81tin3 84.105.226.128,127.0.0.1 /rest/scriptrunner/behaviours/latest/runvalidator.json [c.o.jira.behaviours.BehaviourManagerImpl] Script function failed on issue: issue: XXX-425, user: ROBS, fieldId: customfield_12307, file: <inline script>
2018-04-06 13:19:23,132 http-nio-8080-exec-10 ERROR ROBS 799x7349x1 81tin3 84.105.226.128,127.0.0.1 /rest/scriptrunner/behaviours/latest/runvalidator.json [c.o.jira.behaviours.BehaviourManagerImpl]
</error>
Hope you can help me with this.