The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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 Champions.
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.