Script Runner Date Comparison to send an email


I am attempting to create a script listener that will send an email when the following conditions are met:

  • Status = In UAT
  • Ticket has been In UAT for more than or equal 30 days

I attempted this myself and came up with the following:

( == 'In UAT')&&("issueFunction" in dateCompare("","today +4w < UAT Release Date"))

This doesn't work and keeps reporting the following error:

javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.dateCompare() is applicable for argument types: (java.lang.String, java.lang.String) values: [, today +4w < UAT Release Date] 

The variable called UAT Release Date is a custom date field.

Any help on this would be greatly appreciated.

Kind Regards



1 answer

1 accepted

0 vote

You've jumbled up JQL and groovy there. But anyway, you can't really use a listener for that as they only fire when the issue changes, and you want to send mail when it hasn't changed for 30 days.

This is what Escalation Services is for in Script Runner... you provide a JQL function, in your case it would be:

status = 'In UAT' and issueFunction in dateCompare("","today +4w &lt; UAT Release Date")

Unchecked, but you can check that query in the issue navigator.

Then specify an action that loops back to itself but sends an email.

Hi Jamie Thanks for getting back to me on this. Do you know how to get the escalation service to use the current system date in the query as the reference to 'today' in the query provided was something i added in when testing from a forum and am not actually sure on how to get the query to use the current system time? The other option is if you know how to get it so that a custom field is populated with a date when a ticket moves into a particular transition as this would then allow me to do a comparison between 2 custom fields? Thanks once again Adam

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

151 views 1 17
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you