query issues AFTER date

Tom Lister January 23, 2017

HI

I want to write a query along the lines of

project = JBIF AND status changed to (Implementing, "Implementation Held") AFTER Due

but i get the error

Date value 'Due' for predicate 'after' is invalid. Valid formats include: 'yyyy/MM/dd HH:mm', 'yyyy-MM-dd HH:mm', 'yyyy/MM/dd', 'yyyy-MM-dd', or a period format e.g. '-5d', '4w 2d'.

but it does work with AFTER startOfWeek() etc

I'm guessing the difference is a function rather than a field or the returned format.

So does anyoen have any pointers to writing a JQL function to 'wrap' an issue field?

We have Adaptavist scriptrunner. Any similar examples?

Tom

1 answer

0 votes
Vasiliy Zverev
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.
January 23, 2017

It seems that dateCompare from ScriptRuuner should help you: https://scriptrunner.adaptavist.com/4.3.0/jira/jql-functions.html

Tom Lister January 23, 2017

i've looked at dateCompare but haven't found a syntax that works.

this is OK

project = JBIF AND status changed to (Implementing, 'Implementation Held')  AFTER startOfWeek()

this isn't

project = JBIF AND status changed to (Implementing, 'Implementation Held')  AFTER due

It looks as is status changed returns a date value but the formats are not comparable for built in fields or standard custom fields ( but i can compare due > startOfWeek() as a query but not

resolutiondate > duedate - I think this is why dateCompare was developed?)

tried dateCompare and expression as

project = JBIF AND issueFunction in expression("",status changed to (Implementing, 'Implementation Held') > due)

but syntax is not accepted.

My thoughts are to create a JQL function to wrap a date for use by AFTER. I was looking at an example - just an example based on issue data. most examples seem to be more generic system info functions.

will continue to research...

Vasiliy Zverev
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.
January 23, 2017

Here is a example for all issues with due date after resolution date: 

issueFunction in dateCompare("","dueDate > resolutionDate")
Tom Lister January 24, 2017

thx Vasily ,  that works using dateCompare for straightforward criteria.

I was try to find a way to compare to the date an issue was in a state.

This is accepted

project = JBIF AND status changed to (Implementing, 'Implementation Held')  AFTER startOfWeek()

if there is a date available to reflect when an issue was moved to a state I can paraphrase as

project = JBIF AND status was in (Implementing, 'Implementation Held') AND issueFunction in dateCompare("", "duedate < My Event Date")

So i either need to create and set a date in the workflow or create a JQL function that AFTER clause finds acceptable

(resolutionDate doesn't quite suit as the user wants to see issues in an intermediate state in quite a complex workflow moving through Review, Approval, Implementing, PostReview, Resolved)

As a JQL/Groovy newbie I was hoping for an example of creating a JQL function that accesses issue fields.

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events