Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

How to create a listener condition based on the value of a date custom field of the parent

Tomas Arguinzones Yahoo
Contributor
February 4, 2021

Hi,

I have a listener that I need to fire when the parent issue type is Bug and a date custom field on the parent is < Now(). Something like this:

 

issue.getParentObject().getIssueTypeObject().getName() == 'Bug' && issue.getParentObject().cfValues['GA Release Date']?.value < Now()

 

issue.getParentObject().getIssueTypeObject().getName() == 'Bug' works fine but  issue.getParentObject().cfValues['GA Release Date']?.value < Now() does not. I am not sure how to get the value of the date custom field of the parent and how to compare that value with Now()

 

Any assistance is greatly appreciated.

 

Thank you

 

1 answer

1 accepted

1 vote
Answer accepted
John Chin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2021

Hi @Tomas Arguinzones Yahoo 

I assume the script is run on the Script Listeners and not in the Workflow condition?

If in the Script Listener, you can get the issue parent custom field value by using the following sample script:


def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Date")

def cfValue = issue.getParentObject().getCustomFieldValue(cf) as Date

log.warn "Custom Field value: "+cfValue

def now = new Date()

log.warn "Now: "+now

if(cfValue < now)
{
//dosomething
}

If doesn't help, please let us know where you run the script or send over some screenshots for us to have an overview.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Jira Events