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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

Hi @Tomas Arguinzones 

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

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you