I have a script that works perfectly fine:
def createDate = issue.getCreated();
def today = new java.sql.Timestamp(new Date().getTime());
def resolutionDate = issue.getResolutionDate();
if (resolutionDate == null) {
return today - createDate;
}
if (resolutionDate !== null) {
return resolutionDate - createDate;
}
(This script calculates how old is the Risk issue if open, or how old it was when it was resolved.)
Something that is very similar fails every time:
def issueDate = issue.getCustomFieldValue(
customFieldManager.getCustomFieldObject("customfield_10802"))
def today = new java.sql.Timestamp(new Date().getTime());
def resolutionDate = issue.getResolutionDate();
if (resolutionDate == null) {
return today - isssueDate;
}
if (resolutionDate !== null) {
return resolutionDate - issueDate;
}
(This script calculates how old is the Actualized Risk issue if open, or how old it was when it was resolved. "customfield_10802" is the "actualised Risk aka Issue Date.)
The error i get is "2023-05-10 08:21:23,097 ERROR [customfield.GroovyCustomField]: Script field failed on issue: AECM-240, field: # days as ISSUE groovy.lang.MissingPropertyException: No such property: customFieldManager for class: Script64 at Script64.run(Script64.groovy:2)"
What am I doing wrong?
