Script Listener: Using Updated Date Field as condition

Hi

I am trying to create a script listener were I need the conditions to meet when the job has been in the Awaiting Client column and has not been updated or progressed to a different transition for more than a set time period e.g. 30 days.

This will enable us to monitor our clients work more effectivly by ensuring it doesnt get left.

So far i have the following for the Condition field:

(issue.status?.name=="Awaiting Client") AND (issue.UpdatedDate >= -100d)

It seems to error on the UpdatedDate part of the condition and I cant find any documentation anywhere that define what variables can be called in the condition.

Any help would be greatly apprecaited.

2 answers

1 accepted

try issue.updated

I have tried already and it does not work.

When i use this in the email template: ${issue.updated()}

The following error is produced

groovy.lang.GroovyRuntimeException: Could not find matching constructor for: groovy.lang.Binding(groovy.lang.Binding)

in the mail template you should use ${issue.getUpdated()} or ${issue.updated} - getters shouldbe used properly. As for conditions, could you please give more info how do you add those conditions and put the script itself here?

Basically What im trying to do is set up an custome email script listener that will send an email when a ticket has been in a certain status for more than 30 days for example.

My idea for the conditions to setup this function was to have it compare the updated date of the ticket against the current system date and send an email if it is more than say 30 days.

My attempt at this resulted in:

(issue.status?.name=="Awaiting Client") AND (issue.UpdatedDate > = -100d)

By the way thank you for the getUpdated option.

But that won't be called until the issue is updated, so that condition will never be true (notwithstanding the syntax is all wrong, as Alexey says it's a timestamp.

I think you want https://jamieechlin.atlassian.net/wiki/display/GRV/Escalation%20Service

Ok then that seems to match my requirements. Ill give that a try. :)

I realised that my syntax may be wrong. I dont suppose you have any resources available that would help me for the future when it comes to script listeners with regards to the various fields that are available to be called as it currently takes me a while of searching through the doucmentation and forums before i find that a particular field can be called?

If not it doesnt matter.

Thank you both for your help, it is greatly appreciated.

Adam

To check for issue not being updated in the last 30 days you could use:

issue.updated < new Timestamp((new Date() - 30).getTime())

issue.updated < new Timestamp((new Date() - 30).getTime()) is not workig giving error:

unable to resolve class timestamp

Regarding the javadoc, there are no getUpdatedDate() method on the Issue object (https://docs.atlassian.com/jira/6.3.1/com/atlassian/jira/issue/Issue.html)

I think the method you are looking for is issue.getUpdated() which returns a Timestamp and not a number (don't use <= 100d)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

78 views 0 3
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