Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Calculated Field (SR) question - calculating "days old"


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(
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"

What am I doing wrong?

Days as Issue.jpg

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 10, 2023 • edited

Hi @Lana Decker 

I have reviewed your code, and there is an error because you have not declared the customFieldManager. The customFieldManager is not a bound variable which you can declare directly. Hence, you will need to initialise it first.

To know what are the bound variables for the Scripted Field, you will need to click on the blue question mark icon as shown in the image below:-


If you observe the screenshots above, there is no bound variable for the customFieldManager. This is the main cause of the error you are incurring.

Please modify your code as shown below and see if it helps.

import java.sql.Timestamp
import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.customFieldManager
def customField1 = customFieldManager.getCustomFieldObject("customfield_10802")
def issueDate = issue.getCustomFieldValue(customField1) as Date
def today = new Timestamp(System.currentTimeMillis())
def resolutionDate = issue.resolutionDate

if (!resolutionDate) {

if (resolutionDate) {

Also, could you please specify what type of field you are using, customfield_10802? I am requesting this to provide a sample code for your reference.

I am looking forward to your feedback.

Thank you and Kind regards,


Thank you for looking into this, Ram!
10803 is a date field (Issue date, or when risk was actualized and became issue)

I did copy-paste with your script and it couldn't compile


10802 was a typo, so i blame me for this one
10802 was a check list field (issue y/n)

Thank you for helping me make progress.
Partially working.jpg
It now only works IF issue is resolved. 
If its still unresolved - there is no number:
Any ideas?

Suggest an answer

Log in or Sign up to answer