Script Listener: Using Updated Date Field as condition

Deleted user August 17, 2014

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

0 votes
Answer accepted
Alexey_Rjeutski__Polontech_
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.
August 20, 2014

try issue.updated

Deleted user August 20, 2014

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)
Alexey_Rjeutski__Polontech_
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.
August 20, 2014

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?

Deleted user August 20, 2014

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.

JamieA
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.
August 20, 2014

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

Deleted user August 20, 2014

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

JamieA
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.
August 21, 2014

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

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

Tanuj Chawla August 30, 2016

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

unable to resolve class timestamp

0 votes
Patrick August 20, 2014

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
TAGS
AUG Leaders

Atlassian Community Events