You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I have a script that works perfectly fine:
(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:
(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?
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) {
today.minus(issueDate)
}
if (resolutionDate) {
resolutionDate.minus(issueDate)
}
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,
Ram
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.