I have a custom field that is a Calculated Number Field. I am trying to compare the selected value of a Select List (single choice) field with a string. However, my comparison always returns false even when the selected value matches the string being compared with.
In the formula below, the return value is always 0 (unless the field is null, then it's -1).
The field value is "3-Moderate" but when I compare the field value using issue.get with "3-Moderate" it returns false. I have also tried adding toString() after issue.get() and that does not work either.
Calculated Number Field Formula
@Formula:
var severity = issue.get("customfield_11600");
log.error("value of severity is " + severity);
var moderate = "3-Moderate";
log.error("value of moderate is " + moderate);
(severity != null ? ((severity == moderate) ? 1 : 0) : -1)
-->JIRA Debug Log
2016-10-28 13:21:13,056 http-bio-8080-exec-43 ERROR username 801x81376x2 1p9ubvx ip.address.hidden /secure/AjaxIssueEditAction!default.jspa [innovalog.jmcf.fields.CalculatedNumberField] value of severity is 3-Moderate
2016-10-28 13:21:13,056 http-bio-8080-exec-43 ERROR username 801x81376x2 1p9ubvx ip.address.hidden /secure/AjaxIssueEditAction!default.jspa [innovalog.jmcf.fields.CalculatedNumberField] value of moderate is 3-Moderate
JIRA version v6.3.15 and JMCF version 1.7.1.